diff --git a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java index 2fd28dd507..28943af31b 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/Loader.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/Loader.java @@ -1658,7 +1658,7 @@ public abstract class Loader { } private static boolean hasMaxRows(RowSelection selection) { - return selection != null && selection.getMaxRows() != null; + return selection != null && selection.getMaxRows() != null && selection.getMaxRows() > 0; } private static int getFirstRow(RowSelection selection) { diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/legacy/FooBarTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/legacy/FooBarTest.java index e2ca04c79a..03ecf6d3c5 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/legacy/FooBarTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/legacy/FooBarTest.java @@ -2003,10 +2003,6 @@ public class FooBarTest extends LegacyTestCase { .addOrder( Order.asc("date") ) .list(); assertTrue( list.size()==1 && list.get(0)==f ); - if(!(getDialect() instanceof TimesTenDialect || getDialect() instanceof HSQLDialect)) { - list = s.createCriteria(Foo.class).setMaxResults(0).list(); - assertTrue( list.size()==0 ); - } list = s.createCriteria(Foo.class) .setFirstResult(1) .addOrder( Order.asc("date") )