Using google appengine 1.3.0 with java and jdo ...
When trying to write JDO queries for a one-to-many relationship, I came across a different concept from JDO, which I thought was very smart. Requests of the ancestors. The appengine.api.datastore.Query interface allows you to view a query using the parent key.
Unfortunately, the query results are Entity objects with property lists. Is there a utility in apis that converts one of these Entity objects to my JDO object or even a simple DTO bean (which matches my JDO object)?
I cracked the rough one by forcing it with the code below, but I don't like the double search.
PersistenceManager pm;
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
List<MyObject> results;
com.google.appengine.api.datastore.Query query = new Query( "MyObject", KeyFactory.stringToKey( parentId ) );
query.addFilter("rank", Query.FilterOperator.GREATER_THAN_OR_EQUAL, minRank );
query.addSort("rank");
query.setKeysOnly();
for (Entity anEntity : datastore.prepare(query).asIterable()) {
results.add( pm.getObjectById( MyObject.class, anEntity.getKey() ) );
}