HHH-10952 - Tests leaving transactions opened cause PostgreSQL to hang
This commit is contained in:
parent
468307f394
commit
1da8f01740
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue