[google-appengine] Re: Persisting Enum values?

2009-08-04 Thread Albert Attard
Hi:
I'm not sure about this, but my understanding was that JDO didn't support
ENUMS, JPA does (but I may be wrong).

Cheers,
Albert Attard

Joan Crawfordhttp://www.brainyquote.com/quotes/authors/j/joan_crawford.html
- I, Joan Crawford, I believe in the dollar. Everything I earn, I
spend.

2009/8/3 Jeff S (Google) j...@google.com

 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=ensa=Ncd=2ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.java


 http://www.google.com/codesearch/p?hl=ensa=Ncd=2ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.javaThank
 you,

 Jeff

 On Thu, Jul 30, 2009 at 5:09 PM, Tom Ball tball...@gmail.com 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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Persisting Enum values?

2009-08-04 Thread datanucleus

 I'm not sure about this, but my understanding was that JDO didn't support
 ENUMS, JPA does (but I may be wrong).

Try this
http://db.apache.org/jdo/field_types.html

It's ok to be wrong ;-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Persisting Enum values?

2009-08-04 Thread Albert Attard
Cheers mate. The documentation I've read otherwise (
http://www.jpox.org/docs/1_2/jdovsjpa.html) but good to know that these are
supported.
Cheers,
Albert Attard

Ogden Nash http://www.brainyquote.com/quotes/authors/o/ogden_nash.html  -
The trouble with a kitten is that when it grows up, it's always a cat.

2009/8/4 datanucleus andy_jeffer...@yahoo.com


  I'm not sure about this, but my understanding was that JDO didn't support
  ENUMS, JPA does (but I may be wrong).

 Try this
 http://db.apache.org/jdo/field_types.html

 It's ok to be wrong ;-)

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Persisting Enum values?

2009-08-03 Thread Jeff S (Google)
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=ensa=Ncd=2ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.java

http://www.google.com/codesearch/p?hl=ensa=Ncd=2ct=rc#79kbA0UmWLw/trunk/tests/org/datanucleus/test/HasEnumJDO.javaThank
you,

Jeff

On Thu, Jul 30, 2009 at 5:09 PM, Tom Ball tball...@gmail.com 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 google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---