HHH-5594 org.hibernate.test.jpa.lock.JPALockTest fails on hsqldb

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@20700 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Strong Liu 2010-09-25 09:22:27 +00:00
parent 834551b33e
commit c31d2b093d
1 changed files with 19 additions and 0 deletions

View File

@ -5,10 +5,12 @@ import junit.framework.Test;
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 @@ public class JPALockTest extends AbstractJPATest {
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();