mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-25 12:55:21 +00:00
EJB-407 - Fixing the test cases, to close the EM and/or finish the active transaction
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@15676 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
ff1be35e7d
commit
468743d2a7
@ -116,6 +116,7 @@ public void testPrePersistOnCascade() throws Exception {
|
||||
em.flush();
|
||||
assertNotNull( rc.getCreationDate() );
|
||||
em.getTransaction().rollback();
|
||||
em.close();
|
||||
}
|
||||
|
||||
public void testCallBackListenersHierarchy() throws Exception {
|
||||
|
@ -66,6 +66,9 @@ public void testFlushOnDetached() throws Exception {
|
||||
for (Decorate value : founds) {
|
||||
assertTrue( names.contains( value.getPet().getName() ) );
|
||||
}
|
||||
manager.getTransaction().rollback();
|
||||
|
||||
manager.close();
|
||||
|
||||
}
|
||||
|
||||
|
@ -99,6 +99,7 @@ public void testConstraintViolationException() throws Exception {
|
||||
catch( PersistenceException e ) {
|
||||
Throwable t = e.getCause();
|
||||
assertTrue("Should be a constraint violation", t instanceof ConstraintViolationException);
|
||||
em.getTransaction().rollback();
|
||||
}
|
||||
finally {
|
||||
em.close();
|
||||
|
@ -30,6 +30,8 @@ public void testLockRead() throws Exception {
|
||||
assertEquals( "surname", lock.getName() );
|
||||
em.remove( lock );
|
||||
em.getTransaction().commit();
|
||||
|
||||
em.close();
|
||||
}
|
||||
|
||||
public void testLockWrite() throws Exception {
|
||||
|
@ -42,6 +42,7 @@ public void testAlwaysTransactionalOperations() throws Exception {
|
||||
em.getTransaction().begin();
|
||||
em.remove( em.find( Book.class, book.id ) );
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
||||
}
|
||||
|
||||
// public void testTransactionalOperationsWhenTransactional() throws Exception {
|
||||
|
Loading…
x
Reference in New Issue
Block a user