diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java index f509a9a0c6a..079856d31df 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java @@ -14,7 +14,6 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc; import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; import ca.uhn.fhir.jpa.util.ResourceCountCache; -import ca.uhn.fhir.jpa.util.SingleItemLoadingCache; import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.MetaDt; @@ -42,7 +41,6 @@ import org.springframework.transaction.support.TransactionTemplate; import javax.persistence.EntityManager; import java.io.IOException; import java.io.InputStream; -import java.util.Map; import static org.junit.Assert.*; import static org.mockito.Mockito.mock; @@ -181,12 +179,13 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest { } @Before - @Transactional public void beforeFlushFT() { - FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager); - ftem.purgeAll(ResourceTable.class); - ftem.purgeAll(ResourceIndexedSearchParamString.class); - ftem.flushToIndexes(); + runInTransaction(() -> { + FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager); + ftem.purgeAll(ResourceTable.class); + ftem.purgeAll(ResourceIndexedSearchParamString.class); + ftem.flushToIndexes(); + }); myDaoConfig.setSchedulingDisabled(true); myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java index 7c04b2d22eb..971b6342282 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java @@ -274,12 +274,13 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { } @Before - @Transactional public void beforeFlushFT() { - FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager); - ftem.purgeAll(ResourceTable.class); - ftem.purgeAll(ResourceIndexedSearchParamString.class); - ftem.flushToIndexes(); + runInTransaction(() -> { + FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager); + ftem.purgeAll(ResourceTable.class); + ftem.purgeAll(ResourceIndexedSearchParamString.class); + ftem.flushToIndexes(); + }); myDaoConfig.setSchedulingDisabled(true); myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java index bcea6129cd7..5c48b74c639 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java @@ -282,12 +282,13 @@ public abstract class BaseJpaR4Test extends BaseJpaTest { } @Before - @Transactional public void beforeFlushFT() { - FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager); - ftem.purgeAll(ResourceTable.class); - ftem.purgeAll(ResourceIndexedSearchParamString.class); - ftem.flushToIndexes(); + runInTransaction(()->{ + FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager); + ftem.purgeAll(ResourceTable.class); + ftem.purgeAll(ResourceIndexedSearchParamString.class); + ftem.flushToIndexes(); + }); myDaoConfig.setSchedulingDisabled(true); myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED); diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1156a3d50fd..19e2f842052 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -7,6 +7,11 @@