有人知道如何将数据存储游标与 JPA 结合使用吗?
最佳答案
你能试试这个吗(改编自JDO sample):
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...
关于java - 如何在 GAE 上将数据存储游标与 jpa 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2486551/