I do not see any documentation regarding cursor support with JPA.
Is the following code the correct way to use cursors ?
In this sample code, i will retrieve users from 300 to 320
(query.setMaxResults(20); query.setFirstResult(300);)
The test is OK with the Local Eclipse GAE plugin
@Test
public void getUsersCursorTest() {
EntityManagerFactory emf = null;
EntityManager em = null;
emf = AppEntityManagerFactory.get();
try {
em = emf.createEntityManager();
Query query = em.createNamedQuery("User.findAll");
query.setMaxResults(20);
query.setFirstResult(300);
List<User> users = query.getResultList();
_logger.info("UsersWithMax: " + users.size());
for (User user: users) {
_logger.info("User: " + user);
}
} finally {
if (em != null)
em.close();
}
}
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.