mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-27 14:30:16 +00:00
HHH-18077 Fix key selection paging to previous pages
This commit is contained in:
parent
eef5cc2536
commit
4ae64eeb3f
@ -181,6 +181,12 @@ public KeyedResultList<R> getKeyedResultList(KeyedPage<R> keyedPage) {
|
||||
}
|
||||
|
||||
private static <R> KeyedPage<R> nextPage(KeyedPage<R> keyedPage, List<KeyedResult<R>> results) {
|
||||
if (keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE) {
|
||||
return !results.isEmpty()
|
||||
? keyedPage.nextPage( results.get(0).getKey() )
|
||||
: null;
|
||||
}
|
||||
|
||||
final int pageSize = keyedPage.getPage().getSize();
|
||||
return results.size() == pageSize + 1
|
||||
? keyedPage.nextPage( results.get(pageSize - 1).getKey() )
|
||||
@ -188,6 +194,13 @@ private static <R> KeyedPage<R> nextPage(KeyedPage<R> keyedPage, List<KeyedResul
|
||||
}
|
||||
|
||||
private static <R> KeyedPage<R> previousPage(KeyedPage<R> keyedPage, List<KeyedResult<R>> results) {
|
||||
if (keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE) {
|
||||
final int pageSize = keyedPage.getPage().getSize();
|
||||
return results.size() == pageSize + 1
|
||||
? keyedPage.previousPage( results.get(pageSize - 1).getKey() )
|
||||
: null;
|
||||
}
|
||||
|
||||
return !results.isEmpty()
|
||||
? keyedPage.previousPage( results.get(0).getKey() )
|
||||
: null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user