From bb8ceaea1dd3128e2da1ba4aa5ca5587424d403c Mon Sep 17 00:00:00 2001 From: Nathan Xu Date: Tue, 25 Feb 2020 18:13:50 -0500 Subject: [PATCH] Fix an obvious bug in AbstractLimitHandler --- .../hibernate/dialect/pagination/AbstractLimitHandler.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/AbstractLimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/AbstractLimitHandler.java index cf804e77a2..cf0fa3e4c2 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/AbstractLimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/AbstractLimitHandler.java @@ -226,11 +226,11 @@ public abstract class AbstractLimitHandler implements LimitHandler { * * @param selection The row selection options * - * @return Whether a first row limit in indicated + * @return Whether a first row limit was indicated */ public static boolean hasFirstRow(RowSelection selection) { return selection != null - && selection.getFirstRow() == null + && selection.getFirstRow() != null && selection.getFirstRow() > 0; } @@ -244,7 +244,7 @@ public abstract class AbstractLimitHandler implements LimitHandler { * @return The appropriate value to bind into the limit clause. */ protected final int getMaxOrLimit(RowSelection selection) { - if ( selection==null || selection.getMaxRows()==null ) { + if ( selection == null || selection.getMaxRows() == null ) { return Integer.MAX_VALUE; } final int firstRow = getFirstRow( selection );