Hi
Probably the topic is already discussed and not once but still I can't
find any explanation :-(
So, I have an object, which contains list of another objects. Like
this:

@PersistenceCapable
public class ItemCollection {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        Key key;
        @Persistent
        String Name;
        @Persistent(mappedBy = "owner")
        List<Item> items = new ArrayList<Item>();
}

and have class Item:

@PersistenceCapable
public class Item {
        @PrimaryKey
        @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
        Key key;
        @Persistent
        String name;
        @Persistent
        ItemCollection owner;
}

Then I try to persist parent object:
Item item = new Item();
item.name = "Item 1";
coll = new ItemCollection();
coll.Name = "Collection 1";
coll.items.add(item);
PersistenceManager pm = PMF.get().getPersistenceManager();
pm.makePersistent(coll);

And then I try to retrieve it:
PersistenceManager pm = PMF.get().getPersistenceManager();
Extent<ItemCollection> extent = pm.getExtent(ItemCollection.class);
Iterator<ItemCollection> iterator = extent.iterator();
while (iterator.hasNext())
{
        coll = iterator.next();
}


And I see the ItemCollection fields (like Name) are retrieved but
coll.items remains empty (but not null). How can I get child list?
Thanks

-- 
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 [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-java?hl=en.

Reply via email to