java - 如何在 GAE 上将数据存储游标与 jpa 一起使用

标签 java google-app-engine jpa google-cloud-datastore cursors

有人知道如何将数据存储游标与 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/

相关文章:

java - 如何获取selenium中特定标签的详细信息?

java - Dagger 2.10 : Subcomponent + Custom scope = "cannot be provided without an @Inject constructor or from an @Provides- or @Produces-annotated method"

java - 我正在尝试创建一个 MVP(最小可行产品)。 Google App Engine 是一个很好用的框架吗?

google-app-engine - GAE 中是否不允许@ManyToMany 关系?

java - 通过 jpa 将两个表连接到一个 java 对象中

java - Hibernate:JPQL 查询中使用的 native 查询的 BigInteger 与 Long

java - 使用 xpath 选择重复值

java - Log4j2 - 覆盖现有日志文件配置

jquery - 服务器端 Python (GAE) 中的 Un -"jQuery $.param"

google-app-engine - GWT 生成的 HTML 文件太大