From 1da8f01740174cf9316ab55603e6e92093d4abca Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Wed, 3 Aug 2016 23:04:23 +0200 Subject: [PATCH] HHH-10952 - Tests leaving transactions opened cause PostgreSQL to hang --- .../test/BaseEnversJPAFunctionalTestCase.java | 20 +------------------ 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java index 28bac8234f..b985d21590 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/BaseEnversJPAFunctionalTestCase.java @@ -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() {