diff --git a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java index 3c8e99ced5..31b24ca769 100644 --- a/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java +++ b/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AbstractQueryMethod.java @@ -376,22 +376,10 @@ public abstract class AbstractQueryMethod extends AbstractAnnotatedMethod { "\t\t\t\t\t\t.stream()\n" + "\t\t\t\t\t\t.map(_key -> Cursor.forKey(_key.toArray()))\n" + "\t\t\t\t\t\t.collect(toList());\n" + - "\t\tvar _next =\n" + - "\t\t\t\tPageRequest.of(Entity.class)\n" + - //SHOULD NOT have cast to raw Iterable - "\t\t\t\t\t\t.sortBy((Iterable) pageRequest.sorts())\n" + - "\t\t\t\t\t\t.size(pageRequest.size())\n" + - "\t\t\t\t\t\t.page(pageRequest.page() + 1);\n" + - "\t\tvar _last =\n" + - "\t\t\t\tPageRequest.of(Entity.class)\n" + - //SHOULD NOT have cast to raw Iterable - "\t\t\t\t\t\t.sortBy((Iterable) pageRequest.sorts())\n" + - "\t\t\t\t\t\t.size(pageRequest.size())\n" + - "\t\t\t\t\t\t.page(pageRequest.page() - 1);\n" + //SHOULD BE new CursoredPageRecord<> "\t\treturn new CursoredPageRecord(_results.getResultList(), _cursors, _totalResults, pageRequest,\n" + - "\t\t\t\t_results.isLastPage() ? null : _next.afterKey(_results.getNextPage().getKey().toArray()),\n" + - "\t\t\t\t_results.isFirstPage() ? null : _last.beforeKey(_results.getPreviousPage().getKey().toArray()));"; + "\t\t\t\t_results.isLastPage() ? null : pageRequest.page(pageRequest.page()+1).afterCursor(_cursors.get(_cursors.size()-1)),\n" + + "\t\t\t\t_results.isFirstPage() ? null : pageRequest.page(pageRequest.page()-1).beforeCursor(_cursors.get(0)));"; static final String MAKE_KEYED_PAGE = "\tvar _unkeyedPage =\n" +