Hello app engine team, I'd like to have a search form, which allows user to search next if more result available by using a Cursor. My issue is, in the last chunk, I am not able to detect if it's. Therefore, I will need to execute one additional query to test if more data.
Can you please advise if other approach, without using the 2nd query. Thanks. By document, CursorHelper.getCursor(List<?>) will return a Cursor which points to the last element in the list. The code is below (correct according to doc) import com.google.appengine.api.datastore.Cursor; EntityManager em = ... Query query = em.createQuery(queryString); query.setMaxResults(20); em.getTransaction().begin(); List<TestEntity> testEntities = query.getResultList(); Cursor cursor = JPACursorHelper.getCursor(testEntities); em.getTransaction().rollback(); Then I will need to invoke one more call later, to check a null cursor returned indicates no more data available query.setMaxResults(1); query.setHint(JPACursorHelper.CURSOR_HINT, cursor); em.getTransaction().begin(); List<TestEntity> testEntities = query.getResultList(); Cursor cursor = JPACursorHelper.getCursor(testEntities); em.getTransaction().rollback(); By curiosity (please correct me if I'm wrong), I looked into org.datanucleus.store.appengine.query and found that StreamingQueryResult returned by DatastoreQuery, which was in fact constructed from com.google.appengine.api.datastore.QueryResultList. The document say return a cursor that points to the result immediately after the last one in this list. http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/QueryResultList.html#getCursor() So I wonder if CursorHelper.getCursor(List<?>) can have something similar? Thank you. -- You received this message because you are subscribed to the Google Groups "Google App Engine for Java" group. To post to this group, send email to google-appengine-j...@googlegroups.com. To unsubscribe from this group, send email to google-appengine-java+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine-java?hl=en.