[appengine-java] Re: Query for children of entity with JDO

2010-04-20 Thread timwhunt
Thanks for both suggestions. datanucleus is including the parent as an object in each child: > So do a JDOQL query for the elements > pm.newQuery("SELECT FROM MyElement WHERE myParent == :parent"); > and pass in the parent object, and add on any other filter > requirements. That sounds to me lik

[appengine-java] Re: Query for children of entity with JDO

2010-04-18 Thread hsjawanda
Even though Datanucleus' method seems better, I thought I'd list how I would have done it. If anyone thinks that there would be problems doing it my way, please let us all know. Store a unique property of the parent (this would usually be the PrimaryKey of the parent) in a data field of the child

[appengine-java] Re: Query for children of entity with JDO

2010-04-17 Thread datanucleus
> Thanks a lot for the thoughts Hani, but I do only want the children, So do a JDOQL query for the elements pm.newQuery("SELECT FROM MyElement WHERE myParent == :parent"); and pass in the parent object, and add on any other filter requirements. -- You received this message because you are subscr

[appengine-java] Re: Query for children of entity with JDO

2010-04-17 Thread timwhunt
Thanks a lot for the thoughts Hani, but I do only want the children, so unfortunately, that doesn't solve my problem. The parent is going to be an entity for each user. So for a given user, I'll want to get all the children of the user entity that also meet other filter requirements. Anyone have

[appengine-java] Re: Query for children of entity with JDO

2010-04-17 Thread boustanihani
I am also new to JDO :) but this is what I am doing currently: By setting @Persistent(defaultFetchGroup = "true") on the child/ children loading the parent will automatically load all children ... Does this help? Or do you need to get children only without their parent ? See => http://code.google.