From 2eac7c33ecb27f3dd88b7103beedfbed3450946e Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Fri, 30 Dec 2011 18:47:44 -0600 Subject: [PATCH] HHH-5275 - Criteria.setLockMode does not work correctly --- .../matrix/java/org/hibernate/test/locking/LockModeTest.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/locking/LockModeTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/locking/LockModeTest.java index f7b6dd952d..a5561069ca 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/locking/LockModeTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/locking/LockModeTest.java @@ -184,6 +184,7 @@ public class LockModeTest extends BaseCoreFunctionalTestCase { it2.setValue( "changed" ); s.flush(); fail( "Pessimistic lock not obtained/held" ); + s.getTransaction().commit(); } catch ( Exception e ) { // grr, exception can be any number of types based on database @@ -196,9 +197,9 @@ public class LockModeTest extends BaseCoreFunctionalTestCase { else { fail( "Unexpected error type testing pessimistic locking : " + e.getClass().getName() ); } + s.getTransaction().rollback(); } finally { - s.getTransaction().commit(); s.close(); } }