HHH-18077 extremely minor cleanup after fix
Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
5512281a5e
commit
dc0ca6382f
|
@ -181,29 +181,33 @@ abstract class AbstractSqmSelectionQuery<R> extends AbstractSelectionQuery<R> {
|
|||
}
|
||||
|
||||
private static <R> KeyedPage<R> nextPage(KeyedPage<R> keyedPage, List<KeyedResult<R>> results) {
|
||||
if (keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE) {
|
||||
if ( keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE ) {
|
||||
// the results come in reverse order
|
||||
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() )
|
||||
: null;
|
||||
else {
|
||||
final int pageSize = keyedPage.getPage().getSize();
|
||||
return results.size() == pageSize + 1
|
||||
? keyedPage.nextPage( results.get(pageSize - 1).getKey() )
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
private static <R> KeyedPage<R> previousPage(KeyedPage<R> keyedPage, List<KeyedResult<R>> results) {
|
||||
if (keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE) {
|
||||
if ( keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE ) {
|
||||
// the results come in reverse order
|
||||
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;
|
||||
else {
|
||||
return !results.isEmpty()
|
||||
? keyedPage.previousPage( results.get(0).getKey() )
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract Class<R> getExpectedResultType();
|
||||
|
|
|
@ -47,6 +47,7 @@ class KeyedResult<R> {
|
|||
}
|
||||
break;
|
||||
case KEY_OF_FIRST_ON_NEXT_PAGE:
|
||||
// the results come in reverse order
|
||||
for (int i = pageSize-1; i>=0; i--) {
|
||||
if (i < size) {
|
||||
resultList.add( executed.get(i).getResult() );
|
||||
|
|
Loading…
Reference in New Issue