views:

137

answers:

0
SELECT FROM Foo 
  WHERE sort < sortParam 
  PARAMETERS String sortParam 
  ORDER BY sort 
  RANGE 15,16

where there are less then 15 objects throws a java.lang.IllegalStateException exception.

Do I just need to catch that exception to handle the case when there are fewer then 15 records, or is there something else going on that I'm missing?

Update:
This does not cause an exception to be thrown(added equality to inequality comparison). I'd love to know why.

SELECT FROM Foo 
  WHERE sort <= sortParam 
  PARAMETERS String sortParam 
  ORDER BY sort 
  RANGE 15,16

Stacktrace

Caused by: java.lang.IllegalStateException
 at com.google.appengine.api.datastore.dev.LocalDatastoreService$LiveQuery.compile(LocalDatastoreService.java:1453)
 at com.google.appengine.api.datastore.dev.LocalDatastoreService.next(LocalDatastoreService.java:831)
 at com.google.appengine.api.datastore.dev.LocalDatastoreService.runQuery(LocalDatastoreService.java:767)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.google.appengine.tools.development.ApiProxyLocalImpl.makeSyncCall(ApiProxyLocalImpl.java:118)
 at com.google.apphosting.api.ApiProxy.makeSyncCall(ApiProxy.java:83)
 at com.google.appengine.api.datastore.DatastoreApiHelper.makeSyncCall(DatastoreApiHelper.java:52)
 at com.google.appengine.api.datastore.DatastoreServiceImpl$PreparedQueryImpl.runQuery(DatastoreServiceImpl.java:388)
 at com.google.appengine.api.datastore.DatastoreServiceImpl$PreparedQueryImpl.asQueryResultList(DatastoreServiceImpl.java:318)
 at org.datanucleus.store.appengine.query.DatastoreQuery.fulfillEntityQuery(DatastoreQuery.java:355)
 at org.datanucleus.store.appengine.query.DatastoreQuery.executeQuery(DatastoreQuery.java:265)
 at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:228)
 at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:85)
 at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
 at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
 at org.datanucleus.jdo.JDOQuery.execute(JDOQuery.java:266)
 at com.bitdual.server.dao.QuestionDao.getNextPageFirstIdByVote(QuestionDao.java:218)
 at com.bitdual.server.QuestionServiceImpl.getByVotes(QuestionServiceImpl.java:290)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
 at java.lang.reflect.Method.invoke(Unknown Source)
 at com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:100)
 at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:562)