Hi Tom, It should be possible to persist objects that use enums without needing to do your own additional mapping. I talked this over with Max Ross who frequents the Java runtime discussion group ( http://groups.google.com/group/google-appengine-java) and he pointed out an example in the JDO unit tests which uses enums:
http://www.google.com/codesearch/p?hl=en&sa=N&cd=2&ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.java <http://www.google.com/codesearch/p?hl=en&sa=N&cd=2&ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.java>Thank you, Jeff On Thu, Jul 30, 2009 at 5:09 PM, Tom Ball <[email protected]> wrote: > We have a simple task object, currently persisted using JDO (using App > Engine, of course). We'd like to add a GREEN/YELLOW/RED status enum state. > Defining the enum class is easy: > > public enum Status { > > NONE("none"), GREEN("green"), YELLOW("yellow"), RED("red"); > > > private final String label; > > > Status(String label) { > > this.label = label; > > } > > > public String getLabel() { > > return label; > > } > > } > > We're stumped how to make this class persistent using JDO -- foreign keys > for the labels, perhaps? Or do we get it for free, perhaps by JDO storing > the enum ordinal? > > Tom > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---
