How can I retreive only one entity from a query on Google App Engine. I’m creating a query for with ORDER BY and using:
List<Object> objs= (List<Object>) pm.newQuery(query).execute();
if (objs.size() > 0) {
obj= objs.get(0);
}
But, when I have a large amount of “Objs” in Database, the query is too expensive, and I’m having too much delay.
There is another way to do this query?
Have a look at this document.
These are valid usages of a query:
and
In your case I guess you can use the latter syntax.
It uses low level Java API rather than JDO, but it shouldn’t put you off from using it.