HHH-7298 org.hibernate.test.dialect.functional.SQLServerDialectTest#testLockNowaitSqlServer catches wrong exception

This commit is contained in:
Strong Liu 2012-06-01 15:52:00 +08:00
parent c0b4b7a577
commit 0996a970ab
2 changed files with 4 additions and 3 deletions

View File

@ -24,7 +24,7 @@
hibernate.dialect org.hibernate.dialect.PostgreSQL82Dialect
hibernate.connection.driver_class org.postgresql.Driver
hibernate.connection.url jdbc:postgresql://localhost/hibernate
hibernate.connection.url jdbc:postgresql://127.0.0.1/hibernate
hibernate.connection.username hibernate
hibernate.connection.password hibernate

View File

@ -34,11 +34,13 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.dialect.SQLServer2005Dialect;
import org.hibernate.exception.LockTimeoutException;
import org.hibernate.exception.SQLGrammarException;
import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.jdbc.ReturningWork;
@ -134,7 +136,6 @@ public class SQLServerDialectTest extends BaseCoreFunctionalTestCase {
Session s2 = openSession();
Transaction tx2 = s2.beginTransaction();
//s2.createSQLQuery("SET LOCK_TIMEOUT 5000;Select @@LOCK_TIMEOUT;").uniqueResult(); strangely this is useless for this kind of locks
Product2 kit2 = (Product2) s2.byId( Product2.class ).load( kit.id );
@ -163,7 +164,7 @@ public class SQLServerDialectTest extends BaseCoreFunctionalTestCase {
try {
s2.buildLockRequest( opt ).lock( kit2 );
}
catch ( SQLGrammarException e ) {
catch ( LockTimeoutException e ) {
// OK
}
long end = System.currentTimeMillis();