use of org.hibernate.envers.test.entities.components.Component1 in project hibernate-orm by hibernate.
the class Components method testHistoryOfId3.
@Test
public void testHistoryOfId3() {
ComponentTestEntity ver1 = new ComponentTestEntity(id3, new Component1("a3", "b3"), null);
ComponentTestEntity ver2 = new ComponentTestEntity(id3, new Component1("a3", "b3'"), null);
assert getAuditReader().find(ComponentTestEntity.class, id3, 1).equals(ver1);
assert getAuditReader().find(ComponentTestEntity.class, id3, 2).equals(ver1);
assert getAuditReader().find(ComponentTestEntity.class, id3, 3).equals(ver2);
assert getAuditReader().find(ComponentTestEntity.class, id3, 4).equals(ver2);
}
use of org.hibernate.envers.test.entities.components.Component1 in project hibernate-orm by hibernate.
the class ComponentMapKey method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
ComponentMapKeyEntity imke = new ComponentMapKeyEntity();
// Revision 1 (intialy 1 mapping)
em.getTransaction().begin();
ComponentTestEntity cte1 = new ComponentTestEntity(new Component1("x1", "y2"), new Component2("a1", "b2"));
ComponentTestEntity cte2 = new ComponentTestEntity(new Component1("x1", "y2"), new Component2("a1", "b2"));
em.persist(cte1);
em.persist(cte2);
imke.getIdmap().put(cte1.getComp1(), cte1);
em.persist(imke);
em.getTransaction().commit();
// Revision 2 (sse1: adding 1 mapping)
em.getTransaction().begin();
cte2 = em.find(ComponentTestEntity.class, cte2.getId());
imke = em.find(ComponentMapKeyEntity.class, imke.getId());
imke.getIdmap().put(cte2.getComp1(), cte2);
em.getTransaction().commit();
//
cmke_id = imke.getId();
cte1_id = cte1.getId();
cte2_id = cte2.getId();
}
Aggregations