Skip to content

Commit ecd23af

Browse files
committed
Fix ImmutableNaturalIdTest
1 parent 0d84eb7 commit ecd23af

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

hibernate-core/src/test/java/org/hibernate/test/jpa/naturalid/ImmutableNaturalIdTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,11 @@ public void testNaturalIdCheck() throws Exception {
8585
fail();
8686
}
8787
catch ( PersistenceException p ) {
88+
//expected
89+
t.rollback();
8890
}
8991
u.setUserName( "steve" );
9092
s.delete( u );
91-
t.commit();
9293
s.close();
9394
}
9495

hibernate-core/src/test/java/org/hibernate/test/naturalid/immutable/ImmutableNaturalIdTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
*/
77
package org.hibernate.test.naturalid.immutable;
88

9+
import javax.persistence.PersistenceException;
10+
911
import org.junit.Test;
1012

1113
import org.hibernate.HibernateException;
@@ -76,11 +78,12 @@ public void testNaturalIdCheck() throws Exception {
7678
s.flush();
7779
fail();
7880
}
79-
catch ( HibernateException he ) {
81+
catch ( PersistenceException e ) {
82+
//expected
83+
t.rollback();
8084
}
8185
u.setUserName( "steve" );
8286
s.delete( u );
83-
t.commit();
8487
s.close();
8588
}
8689

0 commit comments

Comments
 (0)