HHH-7187 - Fix tests against MSSQL

This commit is contained in:
Lukasz Antoniak 2012-03-25 06:06:59 +02:00
parent 78ae6abad1
commit e835881f37
3 changed files with 10 additions and 6 deletions

View File

@ -353,7 +353,7 @@ public class DefaultValueComponents extends AbstractEntityTest {
Long entCount = (Long) em.createQuery(
"select count(s) from DefaultValueComponentTestEntity s where s.id = "
+ expectedId.toString()).getSingleResult();
BigInteger auditCount = (BigInteger) em.createNativeQuery(
Number auditCount = (Number) em.createNativeQuery(
"select count(ID) from DefaultValueComponentTestEntity_AUD s where s.id = "
+ expectedId.toString()).getSingleResult();
String comp2Str1Rev1 = (String) em
@ -365,7 +365,7 @@ public class DefaultValueComponents extends AbstractEntityTest {
"select COMP2_STR1 from DefaultValueComponentTestEntity_AUD s where rev=2 and s.id = "
+ expectedId.toString()).getSingleResult();
assert Long.valueOf(1L).equals(entCount);
assert BigInteger.valueOf(2L).equals(auditCount);
assert Integer.valueOf(2).equals(auditCount.intValue());
if (expectedComp2Str1Rev1 == null) {
assert comp2Str1Rev1 == null;

View File

@ -32,6 +32,7 @@ import java.util.Set;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.hibernate.dialect.SQLServerDialect;
import org.junit.Test;
import org.hibernate.Session;
@ -99,8 +100,9 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends AbstractEntityT
session
.createSQLQuery(
"CREATE TABLE children_AUD(REV integer NOT NULL, REVEND integer, "
+ revendTimestampColumName
+ " timestamp, REVTYPE tinyint, "
+ revendTimestampColumName + " "
+ (getDialect() instanceof SQLServerDialect ? "datetime" : "timestamp")
+ ", REVTYPE tinyint, "
+ "parent_id integer, child1_id integer NULL, child2_id integer NULL)")
.executeUpdate();
em.getTransaction().commit();

View File

@ -33,6 +33,7 @@ import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.junit.Test;
import org.hibernate.Session;
@ -99,8 +100,9 @@ public class ValidityAuditStrategyRevEndTsTest extends AbstractEntityTest {
session
.createSQLQuery(
"CREATE TABLE children_AUD(REV integer NOT NULL, REVEND integer, "
+ revendTimestampColumName
+ " timestamp, REVTYPE tinyint, "
+ revendTimestampColumName + " "
+ (getDialect() instanceof SQLServerDialect ? "datetime" : "timestamp")
+ ", REVTYPE tinyint, "
+ "parent_id integer, child1_id integer NULL, child2_id integer NULL)")
.executeUpdate();
em.getTransaction().commit();