I'm following the docs on this site: http://code.google.com/intl/sv-SE/appengine/docs/java/datastore/jdo/queries.html
From there I learned how to make queries but I seems only to work with one parameter. Here's how I'm doing it successfully:
javax.jdo.Query q1 = pm.newQuery(Player.class);
q1.setFilter("isOpen == true");
List<Player> players = (List<Player>) q1.execute();
That fetches me all the Player object with the boolean isOpen == true. I can do the same thing with a Long, that works too.
Here's the problem: When combining two conditions like this:
javax.jdo.Query q1 = pm.newQuery(Player.class);
q1.setFilter("isOpen == true && lastPing > 100");
List<Player> players = (List<Player>) q1.execute();
The app crashes. Here's the error I'm getting:
Uncaught exception from servlet com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found. The suggested index for this query is: datastore-index kind="Player" ancestor="false" source="manual" property name="isOpen" direction="asc" property name="lastPing" direction="asc" datastore-index
So, does anyone know why this is happening? Any help is greatly appreciated.