Reputation: 47685
I am trying to query a collection of entities by its key in the Google App Engine datastore. This is the query I am trying to execute with no success:
Query query = pm.newQuery(Fix.class);
query.setFilter("__key__ IN param");
query.declareParameters("com.google.appengine.api.datastore.Key param");
query.execute(list); // list is an array of keys
And the error I get is:
javax.jdo.JDOUserException: Portion of expression could not be parsed: IN param
Is it possible to use build an IN query with JDO or the low level API that finds entities by key?
Upvotes: 1
Views: 1301
Reputation: 14187
I think you might be confusing the JDO and JPA syntax: see examples on this page
JPA:
select from Person where
favoriteFood IN ('cheeseburger', 'pizza', 'fried chicken')
order by favoriteFood, age
JDO:
Query q = pm.newQuery(
"select from Person where :p1.contains(favoriteFood) order by favoriteFood, age");
q.execute(Arrays.asList("cheeseburger", "pizza", "fried chicken"));
Upvotes: 3