Search in sources :

Example 1 with Child

use of ee.estonia.entities.Child in project hibernate-orm by hibernate.

the class EstonianTableAlias method initData.

@Test
@Priority(10)
public void initData() {
    EntityManager em = getEntityManager();
    // Revision 1
    em.getTransaction().begin();
    Parent parent = new Parent("parent");
    Child child = new Child("child");
    parent.getCollection().add(child);
    em.persist(child);
    em.persist(parent);
    em.getTransaction().commit();
    parentId = parent.getId();
    childId = child.getId();
}
Also used : EntityManager(javax.persistence.EntityManager) Parent(ee.estonia.entities.Parent) Child(ee.estonia.entities.Child) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 2 with Child

use of ee.estonia.entities.Child in project hibernate-orm by hibernate.

the class EstonianTableAlias method testAuditChildTableAlias.

@Test
public void testAuditChildTableAlias() {
    Parent parent = new Parent("parent", parentId);
    Child child = new Child("child", childId);
    Parent ver1 = getAuditReader().find(Parent.class, parentId, 1);
    Assert.assertEquals(parent, ver1);
    Assert.assertEquals(TestTools.makeSet(child), ver1.getCollection());
}
Also used : Parent(ee.estonia.entities.Parent) Child(ee.estonia.entities.Child) Test(org.junit.Test)

Aggregations

Child (ee.estonia.entities.Child)2 Parent (ee.estonia.entities.Parent)2 Test (org.junit.Test)2 EntityManager (javax.persistence.EntityManager)1 Priority (org.hibernate.envers.test.Priority)1