diff --git a/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java b/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java index a99c1aba90..c6d8a45292 100644 --- a/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java +++ b/core/src/main/java/org/hibernate/dialect/Oracle9iDialect.java @@ -131,8 +131,11 @@ public class Oracle9iDialect extends Oracle8iDialect { * HHH-4907, I don't know if oracle 8 supports this syntax, so I'd think it is better add this * method here. Reopen this issue if you found/know 8 supports it. */ - public boolean supportsRowValueConstructorSyntaxInInList() { - return true; - } - + public boolean supportsRowValueConstructorSyntaxInInList() { + return true; + } + + public boolean supportsTupleDistinctCounts() { + return false; + } } diff --git a/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java b/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java index 4c9a44baf9..fa7e5b0ae1 100644 --- a/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java +++ b/core/src/main/java/org/hibernate/dialect/SQLServerDialect.java @@ -164,4 +164,8 @@ public class SQLServerDialect extends AbstractTransactSQLDialect { public boolean doesRepeatableReadCauseReadersToBlockWriters() { return false; // here assume SQLServer2005 using snapshot isolation, which does not have this problem } + + public boolean supportsTupleDistinctCounts() { + return false; + } } diff --git a/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java b/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java index bd8664aadd..6b1018dca8 100644 --- a/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java +++ b/testsuite/src/test/java/org/hibernate/test/hql/CriteriaHQLAlignmentTest.java @@ -4,6 +4,7 @@ package org.hibernate.test.hql; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Collections; +import java.util.List; import junit.framework.Test; @@ -33,6 +34,12 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { SelectClause.VERSION2_SQL = true; } + public String[] getMappings() { + return new String[] { + "hql/Animal.hbm.xml", + }; + } + public boolean createSchema() { return true; // needed for the Criteria return type test } @@ -119,6 +126,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { // HHH-1724 Align Criteria with HQL aggregation return types. public void testCriteriaAggregationReturnType() { Session s = openSession(); + s.beginTransaction(); Human human = new Human(); human.setBigIntegerValue( new BigInteger("42") ); human.setBigDecimalValue( new BigDecimal(45) ); @@ -172,6 +180,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { s.delete( human ); s.flush(); + s.getTransaction().commit(); s.close(); } @@ -224,7 +233,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { .setProjection( Projections.count( "nickName" ).setDistinct() ) .uniqueResult(); assertEquals( 2, count.longValue() ); - s.clear(); + s.close(); s = openSession(); t = s.beginTransaction(); @@ -336,5 +345,4 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase { t.commit(); s.close(); } - }