DatastoreService dataSvc =...;

Query query = new Query("MessageRecipients")
   .addFilter("recipients"), FilterOperator.EQUAL,userid)
   .addSort("date", SortDirection.DESCENDING)
   .setKeysOnly();  // <-- Only fetch keys!

//*** from the presentation , mentioned the above can only be done
using low level api, arent jdo/jpa can get the key only value as well
//***http://gae-java-persistence.blogspot.com/2009/10/keys-only-
queries.html


List<Entity> msgRecpts = dataSvc.prepare(query).asList();
List<Key> parents = new ArrayList<Key>();
for(Entity recep : msgREcpts) {
  parents.add(recep.getParent());
}

//Bulk fetch parents using key list
Map<Key, Entity> msg = dataSvc.get(parents);

//***for second part above, what is the different from doing directly
"select in" statement in jpa/jdo ?
//***http://gae-java-persistence.blogspot.com/2009/12/queries-with-and-
in-filters.html



please comments...

-- 
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-j...@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