Author: steve.ebersole(a)jboss.com
Date: 2006-09-01 17:38:49 -0400 (Fri, 01 Sep 2006)
New Revision: 10426
Modified:
trunk/Hibernate3/test/org/hibernate/test/jpa/lock/RepeatableReadTest.java
Log:
fixed failures on SQLServer
Modified: trunk/Hibernate3/test/org/hibernate/test/jpa/lock/RepeatableReadTest.java
===================================================================
--- trunk/Hibernate3/test/org/hibernate/test/jpa/lock/RepeatableReadTest.java 2006-09-01
21:36:47 UTC (rev 10425)
+++ trunk/Hibernate3/test/org/hibernate/test/jpa/lock/RepeatableReadTest.java 2006-09-01
21:38:49 UTC (rev 10426)
@@ -189,7 +189,8 @@
// clean up
s1 = getSessions().openSession();
t1 = s1.beginTransaction();
- s1.delete( part );
+ s1.delete( part2 );
+ s1.delete( part2.getItem() );
t1.commit();
s1.close();
}
@@ -231,14 +232,26 @@
assertEquals( "encountered non-repeatable read", check, part2.getName() );
// then acquire an UPGRADE lock; this should fail
- s1.lock( part, LockMode.UPGRADE );
+ try {
+ s1.lock( part, LockMode.UPGRADE );
+ }
+ catch( Throwable t ) {
+ // SQLServer, for example, immediately throws an exception here...
+ t1.rollback();
+ t1 = s1.beginTransaction();
+ }
part2 = ( Part ) s1.get( Part.class, partId );
assertTrue( part == part2 );
assertEquals( "encountered non-repeatable read", check, part2.getName() );
+ t1.commit();
+ s1.close();
+
// clean up
-// s1.refresh( item );
+ s1 = getSessions().openSession();
+ t1 = s1.beginTransaction();
s1.delete( part );
+ s1.delete( part.getItem() );
t1.commit();
s1.close();
}
Show replies by date