Как использовать курсоры хранилища данных с jpa на GAE - PullRequest
1 голос
/ 21 марта 2010

Кто-нибудь знает, как использовать Курсоры Datastore с JPA?

1 Ответ

2 голосов
/ 22 марта 2010

Можете ли вы попробовать это (адаптировано из образца JDO ):

List<Employee> results = (List<Employee>) query.execute();
// Use the first 20 results...

Cursor cursor = JPACursorHelper.getCursor(results);
String cursorString = cursor.toWebSafeString();
// Store the cursorString...

// ...

// Query query = the same query that produced the cursor
// String cursorString = the string from storage
Cursor cursor = Cursor.fromWebSafeString(cursorString);
query.setHint(JPACursorHelper.CURSOR_HINT, cursor);
query.setFirstResult(0);
query.setMaxResults(20);

List<Employee> results = (List<Employee>) query.execute();
// Use the next 20 results...
...