HHH-11364 : Fix test case to work on pre-5.2 versions

This commit is contained in:
Gail Badner 2017-10-03 22:42:57 -07:00
parent 39f529704e
commit c6e285c137
1 changed files with 9 additions and 4 deletions

View File

@ -12,11 +12,12 @@ import org.hibernate.envers.test.entities.StrTestNoProxyEntity;
import org.hibernate.envers.test.entities.collection.EmbeddableListEntity3;
import org.hibernate.envers.test.entities.components.relations.ManyToOneEagerComponent;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test;
import java.util.Arrays;
import javax.persistence.EntityManager;
import static org.junit.Assert.assertEquals;
/**
@ -34,12 +35,16 @@ public class EmbeddableList3 extends BaseEnversJPAFunctionalTestCase {
@Test
@Priority(10)
public void initData() {
ele3_id = TransactionUtil.doInJPA( this::entityManagerFactory, entityManager -> {
EntityManager entityManager = getEntityManager();
entityManager.getTransaction().begin();
{
EmbeddableListEntity3 ele3 = new EmbeddableListEntity3();
ele3.getComponentList().add( new ManyToOneEagerComponent( null, "data" ) );
entityManager.persist( ele3 );
return ele3.getId();
} );
ele3_id = ele3.getId();
}
entityManager.getTransaction().commit();
entityManager.close();
}
@Test