You can run queries on keys:

http://code.google.com/appengine/docs/java/datastore/queriesandindexes.html#Queries_on_Keys

The first part of child key (ContactInfo.class) contains parent
(Employee) key.

 Employee e;
 ....

 query = pm.newQuery(ContactInfo.class);
 query.setFilter("key == keyParam");
 query.declareParameters("com.google.appengine.api.datastore.Key
keyParam");
 Key key = KeyFactory.createKey(Employee.class.getSimpleName(),e.getId
());
 list = (List<ContactInfo>) query.execute(key);

But it returns empty list because the second part of child key
contains child key itself, so it is never equal.

Maybe something like that will work (assuming that your goal is to
find all child belonging to single parent).

 query = pm.newQuery(ContactInfo.class);
 query.setFilter("key > keyParam and key < keyParam1");
 query.declareParameters("com.google.appengine.api.datastore.Key
keyParam");
 query.declareParameters("com.google.appengine.api.datastore.Key
keyParam1");
 Key key = KeyFactory.createKey(Employee.class.getSimpleName(),e.getId
());
 Key key1 = KeyFactory.createKey(Employee.class.getSimpleName(),e.getId
() + 1);
 list = (List<ContactInfo>) query.execute(key,key1);


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to