[hibernate-commits] Hibernate SVN: r20700 - core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Sat Sep 25 05:22:27 EDT 2010


Author: stliu
Date: 2010-09-25 05:22:27 -0400 (Sat, 25 Sep 2010)
New Revision: 20700

Modified:
   core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java
Log:
HHH-5594 org.hibernate.test.jpa.lock.JPALockTest fails on hsqldb

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-09-25 07:57:56 UTC (rev 20699)
+++ core/trunk/testsuite/src/test/java/org/hibernate/test/jpa/lock/JPALockTest.java	2010-09-25 09:22:27 UTC (rev 20700)
@@ -5,10 +5,12 @@
 import org.hibernate.LockMode;
 import org.hibernate.Session;
 import org.hibernate.Transaction;
+import org.hibernate.dialect.HSQLDialect;
 import org.hibernate.testing.junit.functional.FunctionalTestClassTestSuite;
 import org.hibernate.test.jpa.AbstractJPATest;
 import org.hibernate.test.jpa.Item;
 import org.hibernate.test.jpa.MyEntity;
+import org.hibernate.util.ReflectHelper;
 
 /**
  * Tests specifically relating to section 3.3.5.3 [Lock Modes] of the
@@ -61,7 +63,24 @@
 			reportSkip( "deadlock", "jpa read locking" );
 			return;
 		}
+		if ( getDialect() instanceof HSQLDialect ) {
+			int hsqldbVersion = 18;
+			try {
+				Class props = ReflectHelper
+						.classForName( "org.hsqldb.persist.HsqlDatabaseProperties" );
+				String versionString = (String) props.getDeclaredField(
+						"THIS_VERSION").get(null);
 
+				hsqldbVersion = Integer.parseInt( versionString.substring( 0, 1 ) ) * 10;
+				hsqldbVersion += Integer
+						.parseInt( versionString.substring( 2, 3 ) );
+			} catch ( Throwable e ) {
+				// must be a very old version
+			}
+			if ( hsqldbVersion < 20 )
+				reportSkip( "hsqldb 1.8.x only supports read uncommitted", "lock doesn't work on hsqldb 1.8.x");
+			return;
+		}
 		final String initialName = "lock test";
 		// set up some test data
 		Session s1 = getSessions().openSession();



More information about the hibernate-commits mailing list