Author: steve.ebersole(a)jboss.com
Date: 2010-05-08 17:58:15 -0400 (Sat, 08 May 2010)
New Revision: 19429
Modified:
core/trunk/core/src/main/java/org/hibernate/cfg/SettingsFactory.java
core/trunk/parent/pom.xml
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/WithClauseTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/CustomSQLTest.java
Log:
HHH-5200 - Prepare to use H2 as the default testing datbase
Modified: core/trunk/core/src/main/java/org/hibernate/cfg/SettingsFactory.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/cfg/SettingsFactory.java 2010-05-08
21:20:33 UTC (rev 19428)
+++ core/trunk/core/src/main/java/org/hibernate/cfg/SettingsFactory.java 2010-05-08
21:58:15 UTC (rev 19429)
@@ -114,8 +114,18 @@
Connection conn = connections.getConnection();
try {
DatabaseMetaData meta = conn.getMetaData();
- log.info( "RDBMS: " + meta.getDatabaseProductName() + ", version:
" + meta.getDatabaseProductVersion() );
- log.info( "JDBC driver: " + meta.getDriverName() + ", version: "
+ meta.getDriverVersion() );
+ log.info( "Database ->\n" +
+ " name : " + meta.getDatabaseProductName() + '\n' +
+ " version : " + meta.getDatabaseProductVersion() + '\n' +
+ " major : " + meta.getDatabaseMajorVersion() + '\n' +
+ " minor : " + meta.getDatabaseMinorVersion()
+ );
+ log.info( "Driver ->\n" +
+ " name : " + meta.getDriverName() + '\n' +
+ " version : " + meta.getDriverVersion() + '\n' +
+ " major : " + meta.getDriverMajorVersion() + '\n' +
+ " minor : " + meta.getDriverMinorVersion()
+ );
dialect = DialectFactory.buildDialect( props, conn );
jdbcSupport = JdbcSupportLoader.loadJdbcSupport( conn );
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2010-05-08 21:20:33 UTC (rev 19428)
+++ core/trunk/parent/pom.xml 2010-05-08 21:58:15 UTC (rev 19429)
@@ -592,7 +592,7 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <version>1.2.124</version>
+ <version>1.2.134</version>
</dependency>
</dependencies>
<properties>
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/hql/WithClauseTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/WithClauseTest.java 2010-05-08
21:20:33 UTC (rev 19428)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/hql/WithClauseTest.java 2010-05-08
21:58:15 UTC (rev 19429)
@@ -185,12 +185,14 @@
public void cleanup() {
Session session = openSession();
Transaction txn = session.beginTransaction();
- session.createQuery( "delete Animal where mother is not null"
).executeUpdate();
- List humansWithFriends = session.createQuery( "from Human h where exists(from
h.friends)" ).list();
- Iterator itr = humansWithFriends.iterator();
- while ( itr.hasNext() ) {
- session.delete( itr.next() );
- }
+ Human father = (Human) session.createQuery( "from Human where description =
'father'" ).uniqueResult();
+ father.getFriends().clear();
+ session.flush();
+ session.delete( session.createQuery( "from Human where description =
'friend'" ).uniqueResult() );
+ session.delete( session.createQuery( "from Human where description =
'child1'" ).uniqueResult() );
+ session.delete( session.createQuery( "from Human where description =
'child2'" ).uniqueResult() );
+ session.delete( session.createQuery( "from Human where description =
'mother'" ).uniqueResult() );
+ session.delete( father );
session.createQuery( "delete Animal" ).executeUpdate();
txn.commit();
session.close();
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java 2010-05-08
21:20:33 UTC (rev 19428)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java 2010-05-08
21:58:15 UTC (rev 19429)
@@ -74,7 +74,7 @@
Long itemId = item.getId();
- // doAfterTransactionCompletion the isolated update
+ // do the isolated update
s1 = getSessions().openSession();
t1 = s1.beginTransaction();
item = (Item) s1.get( Item.class, itemId );
Modified: core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/CustomSQLTest.java
===================================================================
---
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/CustomSQLTest.java 2010-05-08
21:20:33 UTC (rev 19428)
+++
core/trunk/testsuite/src/test/java/org/hibernate/test/legacy/CustomSQLTest.java 2010-05-08
21:58:15 UTC (rev 19429)
@@ -8,6 +8,7 @@
import junit.framework.Test;
import org.hibernate.HibernateException;
+import org.hibernate.id.PostInsertIdentifierGenerator;
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
import org.hibernate.classic.Session;
import org.hibernate.dialect.HSQLDialect;
@@ -31,11 +32,16 @@
return new FunctionalTestClassTestSuite( CustomSQLTest.class );
}
+ private boolean isUsingIdentity() {
+ return PostInsertIdentifierGenerator.class.isAssignableFrom(
getDialect().getNativeIdentifierGeneratorClass() );
+ }
+
public void testInsert() throws HibernateException, SQLException {
+ if ( isUsingIdentity() ) {
+ reportSkip( "hand sql expecting non-identity id gen", "Custom SQL"
);
+ return;
+ }
- if ( getDialect() instanceof HSQLDialect ) return;
- if ( getDialect() instanceof MySQLDialect ) return;
-
Role p = new Role();
p.setName("Patient");
@@ -93,10 +99,11 @@
}
public void testCollectionCUD() throws HibernateException, SQLException {
-
- if ( getDialect() instanceof HSQLDialect ) return;
- if ( getDialect() instanceof MySQLDialect ) return;
-
+ if ( isUsingIdentity() ) {
+ reportSkip( "hand sql expecting non-identity id gen", "Custom SQL"
);
+ return;
+ }
+
Role role = new Role();
role.setName("Jim Flanders");
@@ -155,10 +162,11 @@
}
public void testCRUD() throws HibernateException, SQLException {
+ if ( isUsingIdentity() ) {
+ reportSkip( "hand sql expecting non-identity id gen", "Custom SQL"
);
+ return;
+ }
- if ( getDialect() instanceof HSQLDialect ) return;
- if ( getDialect() instanceof MySQLDialect ) return;
-
Person p = new Person();
p.setName("Max");
@@ -206,7 +214,5 @@
s.connection().commit();
s.close();
-
-
}
}