From e80a934549dee22d63226351bb5f32b2bd38b49d Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Wed, 7 Jan 2009 20:38:25 +0000 Subject: [PATCH] HHH-3693 : implicit polymorphism + pagination git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@15754 1b8cb986-b30d-0410-93ca-fae66ebed9b2 --- .../hibernate/engine/query/HQLQueryPlan.java | 2 +- .../test/hql/ASTParserLoadingTest.java | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/org/hibernate/engine/query/HQLQueryPlan.java b/src/org/hibernate/engine/query/HQLQueryPlan.java index 7fc687a41e..7df6545715 100644 --- a/src/org/hibernate/engine/query/HQLQueryPlan.java +++ b/src/org/hibernate/engine/query/HQLQueryPlan.java @@ -181,7 +181,7 @@ public class HQLQueryPlan implements Serializable { final int size = tmp.size(); for ( int x = 0; x < size; x++ ) { final Object result = tmp.get( x ); - if ( distinction.add( result ) ) { + if ( ! distinction.add( result ) ) { continue; } includedCount++; diff --git a/test/org/hibernate/test/hql/ASTParserLoadingTest.java b/test/org/hibernate/test/hql/ASTParserLoadingTest.java index 8727906de1..e541abdd60 100644 --- a/test/org/hibernate/test/hql/ASTParserLoadingTest.java +++ b/test/org/hibernate/test/hql/ASTParserLoadingTest.java @@ -100,6 +100,29 @@ public class ASTParserLoadingTest extends FunctionalTestCase { return new FunctionalTestClassTestSuite( ASTParserLoadingTest.class ); } + public void testPaginationWithPolymorphicQuery() { + Session s = openSession(); + s.beginTransaction(); + Human h = new Human(); + h.setName( new Name( "Steve", null, "Ebersole" ) ); + s.save( h ); + s.getTransaction().commit(); + s.close(); + + s = openSession(); + s.beginTransaction(); + List results = s.createQuery( "from java.lang.Object" ).setMaxResults( 2 ).list(); + assertEquals( 1, results.size() ); + s.getTransaction().commit(); + s.close(); + + s = openSession(); + s.beginTransaction(); + s.delete( h ); + s.getTransaction().commit(); + s.close(); + } + public void testComponentNullnessChecks() { Session s = openSession(); s.beginTransaction();