Reputation: 381
I am developing an android app with app engine backend. When I run the backend application in remote server, and query for entities using a JPQL query, as below, it returns no results.
queryString= "SELECT i FROM Item AS i WHERE i.locationId= :locId ORDER BY i.itemQuantity";
Query q = mgr.createQuery(queryString);
q.setParameter("locId", location);
However, the same query when run in local development server, it returns results.
Another observation: If we remove parameters and keep the query simple with just the ORDER BY statement, it returns results both in dev server and in remote run.
Upvotes: 0
Views: 51
Reputation: 80330
For complex queries you need to define an explicit composite index.
Local dev server builds this on the fly, while on production server you need to define composite indexes explicitly.
For simple queries, e.g. only with ORDER BY, the composite index is not necessary, so you get the expected result.
Upvotes: 2