Could somebody please provide an example of how to query for the one-
to-many relationship examples in the documentation?

What I want to do is something like the following:

String employeeId = "1234";
query = pm.newQuery(ContactInfo.class);
query.setFilter("employee == employeeParam");
query.declareParameters("String employeeParam");
List<ContactInfo> employeeContacts = (List<ContactInfo>) query.execute
( employeeId );

Should this work?  Or do I need to use an unowned one-to-many,
replacing "private Employee employee;" with "private Key employeeId;"
and then something like:

Key employeeId = KeyFactory.createKey(Employee.class.getSimpleName(),
"1234");
query = pm.newQuery(ContactInfo.class);
query.setFilter("employeeId == employeeParam");
query.declareParameters("Key employeeParam");
List<ContactInfo> employeeContacts = (List<ContactInfo>) query.execute
( employeeId );

(I'm a bit confused by the difference between owned and unowned
relationships)
--~--~---------~--~----~------------~-------~--~----~
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