Jason, Thanks for the reply and checking the code. It is the null issue that is causing this issue, but I had a second issue that I will start a new thread for.
Thanks, Jeff On Fri, Oct 23, 2009 at 4:01 PM, Jason (Google) <apija...@google.com> wrote: > Hi Jeff. I'm having trouble reproducing this. I kept everything uncommented > so the constructor adds a new object to each List/Set, then queried for the > persisted Player2 object and inspected the size of each List/Set and saw 1 > for each (expected). I then commented out foo1 and foo2 but left the > Lists/Sets uncommented and saw the same result. > > There is a known issue where empty Lists (Lists which have been > instantiated but don't have any objects in them) are returned as null. Does > this sound like what you're running into when you leave the constructor > commented out? > > - Jason > > On Thu, Oct 22, 2009 at 12:05 PM, jeffgnpc <jeffg....@gmail.com> wrote: > >> >> I am having an issue loading Collections after they have been stored >> in the datastore. I have simplified this issue down to a simple >> example listed below. If I run with the current comments, everything >> works fine, and the Collections are loaded. If I uncomment "foo1" or >> "foo2", the Collections no longer load (they are null). If I >> uncomment the constructor where I add values to the list, everything >> works fine again. >> >> @PersistenceCapable(identityType = IdentityType.APPLICATION) >> public class Player2 { >> @PrimaryKey >> @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) >> public Long key; >> >> //@Persistent >> //private Long foo1; //Cause Collection issue >> //@Persistent >> //private String foo2; //Causes Collection issue >> @Persistent >> private Key foo3; // This works >> >> @Persistent(defaultFetchGroup = "true") >> private Set<Long> longSet = new HashSet<Long>(); >> @Persistent(defaultFetchGroup = "true") >> private List<Long> longList = new ArrayList<Long>(); >> @Persistent(defaultFetchGroup = "true") >> private Set<String> stringSet = new HashSet<String>(); >> @Persistent(defaultFetchGroup = "true") >> private List<String> stringList = new LinkedList<String>(); >> @Persistent(defaultFetchGroup = "true") >> private Set<Key> keySet = new HashSet<Key>(); >> @Persistent(defaultFetchGroup = "true") >> private List<Key> keyList = new LinkedList<Key>(); >> >> public Player2() { >> //Adding to the List Fixes Collection issue >> //longSet.add(1234l); >> //longList.add(1234l); >> //stringSet.add("1234l"); >> //stringList.add("1234l"); >> //keySet.add(KeyFactory.createKey(Player2.class.getSimpleName >> (), "alfred.sm...@example.com")); >> //keyList.add(KeyFactory.createKey(Player2.class.getSimpleName >> (), "alfred.sm...@example.com")); >> } >> } >> >> >> I believe this might be a similar issue to this thread: >> >> http://groups.google.com/group/google-appengine-java/browse_thread/thread/a44cb049f40d6bab/f9047e0a25e3453f?lnk=gst&q=JDO+collection+null#f9047e0a25e3453f >> >> But when I run with in either of the successful ways, the Collections >> don't seem to be SCO fields. I will also post in that thread in case >> it helps with the ticket. >> >> Thanks, >> Jeff >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-java@googlegroups.com To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en -~----------~----~----~----~------~----~------~--~---