Search code examples
javagoogle-app-enginegoogle-cloud-datastorejdo

How to query the datastore to get child objects and compare their properties using Java?


I am implementing a project on the google app engine. I would like to query the datastore to refer to the child object's property and use it to identify the parent object.

Think of these as the parent and child classes I am talking about:

class Parent {  
String name;  
Child child;  
}      

class Child{  
String id;  
}

I need to create a query on the Parent objects such that it takes the id property from the Child (which is in Parent) and use it to identify the Parent object I need. I know how bad the design is, but please tell me a way to do this. I would love to use the App Engine Datastore queries, but if not possible I'm open to the Java JDO queries too.


Solution

  • Have you looked at

    GAE Java persistence blog: executing simple joins

    I believe that I used the information there to tackle the kind of problem you have.