Skip to content

Commit

Permalink
HHH-11383 : Fix tests to work on pre-5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gbadner committed May 10, 2017
1 parent b19e831 commit 2523f0a
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -9,6 +9,7 @@
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
Expand All @@ -22,7 +23,6 @@
import org.junit.Test;

import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;

import static org.hibernate.envers.query.AuditEntity.disjunction;
import static org.hibernate.envers.query.AuditEntity.property;
Expand All @@ -41,7 +41,9 @@ protected Class<?>[] getAnnotatedClasses() {
@Test
@Priority(10)
public void initData() {
TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
EntityManager entityManager = getOrCreateEntityManager();
entityManager.getTransaction().begin();
{
final EntityC c = new EntityC();
c.setId( 1 );
c.setFoo( "bar" );
Expand All @@ -65,7 +67,9 @@ public void initData() {
b2.setRelationToC( c );
b2.setRelationToD( d );
entityManager.persist( b2 );
} );
}
entityManager.getTransaction().commit();
entityManager.close();
}

@Test
Expand Down

0 comments on commit 2523f0a

Please sign in to comment.