From 8fcbf71a11e2917131a205642d0a69755a6e2e22 Mon Sep 17 00:00:00 2001 From: John Verhaeg Date: Mon, 7 Nov 2011 10:52:38 -0600 Subject: [PATCH] HHH-6809: Changed Loader.hasMaxRows() to return false if maxRows is zero, and removed bad expectation from FooBarTest.testFindByCriteria() --- hibernate-core/src/main/java/org/hibernate/loader/Loader.java | 2 +- .../src/matrix/java/org/hibernate/test/legacy/FooBarTest.java | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) 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") )