HHH-10952 - Tests leaving transactions opened cause PostgreSQL to hang

This commit is contained in:
Andrea Boriero 2016-08-03 23:04:23 +02:00
parent 468307f394
commit 1da8f01740
1 changed files with 1 additions and 19 deletions

View File

@ -261,28 +261,10 @@ public abstract class BaseEnversJPAFunctionalTestCase extends AbstractEnversTest
}
protected AuditReader getAuditReader() {
EntityManager entityManager = getOrCreateEntityManager();
SessionImplementor sessionImplementor = entityManager.unwrap( SessionImplementor.class );
if ( sessionImplementor.getTransactionCoordinator().getTransactionCoordinatorBuilder().isJta() ) {
if ( !JtaStatusHelper.isActive( TestingJtaPlatformImpl.INSTANCE.getTransactionManager() ) ) {
try {
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().begin();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
else if ( !entityManager.getTransaction().isActive() ) {
entityManager.getTransaction().begin();
}
if ( auditReader != null ) {
return auditReader;
}
return auditReader = AuditReaderFactory.get( entityManager );
return auditReader = AuditReaderFactory.get( getOrCreateEntityManager() );
}
protected EntityManager createIsolatedEntityManager() {