HHH-5220 HHH-5231 : Fix unit test failures and DB lockups for SELECT COUNT(DISTINCT arg1, arg2) tests

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19722 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gail Badner 2010-06-14 04:27:40 +00:00
parent c53359d468
commit 9e6d8be376
3 changed files with 21 additions and 6 deletions

View File

@ -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 * 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. * method here. Reopen this issue if you found/know 8 supports it.
*/ */
public boolean supportsRowValueConstructorSyntaxInInList() { public boolean supportsRowValueConstructorSyntaxInInList() {
return true; return true;
} }
public boolean supportsTupleDistinctCounts() {
return false;
}
} }

View File

@ -164,4 +164,8 @@ public class SQLServerDialect extends AbstractTransactSQLDialect {
public boolean doesRepeatableReadCauseReadersToBlockWriters() { public boolean doesRepeatableReadCauseReadersToBlockWriters() {
return false; // here assume SQLServer2005 using snapshot isolation, which does not have this problem return false; // here assume SQLServer2005 using snapshot isolation, which does not have this problem
} }
public boolean supportsTupleDistinctCounts() {
return false;
}
} }

View File

@ -4,6 +4,7 @@ package org.hibernate.test.hql;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import junit.framework.Test; import junit.framework.Test;
@ -33,6 +34,12 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
SelectClause.VERSION2_SQL = true; SelectClause.VERSION2_SQL = true;
} }
public String[] getMappings() {
return new String[] {
"hql/Animal.hbm.xml",
};
}
public boolean createSchema() { public boolean createSchema() {
return true; // needed for the Criteria return type test 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. // HHH-1724 Align Criteria with HQL aggregation return types.
public void testCriteriaAggregationReturnType() { public void testCriteriaAggregationReturnType() {
Session s = openSession(); Session s = openSession();
s.beginTransaction();
Human human = new Human(); Human human = new Human();
human.setBigIntegerValue( new BigInteger("42") ); human.setBigIntegerValue( new BigInteger("42") );
human.setBigDecimalValue( new BigDecimal(45) ); human.setBigDecimalValue( new BigDecimal(45) );
@ -172,6 +180,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
s.delete( human ); s.delete( human );
s.flush(); s.flush();
s.getTransaction().commit();
s.close(); s.close();
} }
@ -224,7 +233,7 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
.setProjection( Projections.count( "nickName" ).setDistinct() ) .setProjection( Projections.count( "nickName" ).setDistinct() )
.uniqueResult(); .uniqueResult();
assertEquals( 2, count.longValue() ); assertEquals( 2, count.longValue() );
s.clear(); s.close();
s = openSession(); s = openSession();
t = s.beginTransaction(); t = s.beginTransaction();
@ -336,5 +345,4 @@ public class CriteriaHQLAlignmentTest extends QueryTranslatorTestCase {
t.commit(); t.commit();
s.close(); s.close();
} }
} }