use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class UnspecifiedEnumTypeTest method initData.
@Test
@Priority(9)
public void initData() {
Session session = getSession();
// Revision 1
session.getTransaction().begin();
UnspecifiedEnumTypeEntity entity = new UnspecifiedEnumTypeEntity(UnspecifiedEnumTypeEntity.E1.X, UnspecifiedEnumTypeEntity.E2.A);
session.persist(entity);
session.getTransaction().commit();
id = entity.getId();
// Revision 2
session.getTransaction().begin();
entity = (UnspecifiedEnumTypeEntity) session.get(UnspecifiedEnumTypeEntity.class, entity.getId());
entity.setEnum1(UnspecifiedEnumTypeEntity.E1.Y);
entity.setEnum2(UnspecifiedEnumTypeEntity.E2.B);
session.update(entity);
session.getTransaction().commit();
session.close();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class Dates method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
em.getTransaction().begin();
DateTestEntity dte = new DateTestEntity(new Date(12345000));
em.persist(dte);
id1 = dte.getId();
em.getTransaction().commit();
em.getTransaction().begin();
dte = em.find(DateTestEntity.class, id1);
dte.setDateValue(new Date(45678000));
em.getTransaction().commit();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class EmbeddableList1 method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
EmbeddableListEntity1 ele1 = new EmbeddableListEntity1();
// Revision 1 (ele1: initially 1 element in both collections)
em.getTransaction().begin();
ele1.getComponentList().add(c3_1);
em.persist(ele1);
em.getTransaction().commit();
// Revision (still 1) (ele1: removing non-existing element)
em.getTransaction().begin();
ele1 = em.find(EmbeddableListEntity1.class, ele1.getId());
ele1.getComponentList().remove(c3_2);
em.getTransaction().commit();
// Revision 2 (ele1: adding one element)
em.getTransaction().begin();
ele1 = em.find(EmbeddableListEntity1.class, ele1.getId());
ele1.getComponentList().add(c3_2);
em.getTransaction().commit();
// Revision 3 (ele1: adding one existing element)
em.getTransaction().begin();
ele1 = em.find(EmbeddableListEntity1.class, ele1.getId());
ele1.getComponentList().add(c3_1);
em.getTransaction().commit();
// Revision 4 (ele1: removing one existing element)
em.getTransaction().begin();
ele1 = em.find(EmbeddableListEntity1.class, ele1.getId());
ele1.getComponentList().remove(c3_2);
em.getTransaction().commit();
ele1_id = ele1.getId();
em.close();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class IdMapKey method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
IdMapKeyEntity imke = new IdMapKeyEntity();
// Revision 1 (intialy 1 mapping)
em.getTransaction().begin();
StrTestEntity ste1 = new StrTestEntity("x");
StrTestEntity ste2 = new StrTestEntity("y");
em.persist(ste1);
em.persist(ste2);
imke.getIdmap().put(ste1.getId(), ste1);
em.persist(imke);
em.getTransaction().commit();
// Revision 2 (sse1: adding 1 mapping)
em.getTransaction().begin();
ste2 = em.find(StrTestEntity.class, ste2.getId());
imke = em.find(IdMapKeyEntity.class, imke.getId());
imke.getIdmap().put(ste2.getId(), ste2);
em.getTransaction().commit();
//
imke_id = imke.getId();
ste1_id = ste1.getId();
ste2_id = ste2.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class EnumSet method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
EnumSetEntity sse1 = new EnumSetEntity();
// Revision 1 (sse1: initialy 1 element)
em.getTransaction().begin();
sse1.getEnums1().add(E1.X);
sse1.getEnums2().add(E2.A);
em.persist(sse1);
em.getTransaction().commit();
// Revision 2 (sse1: adding 1 element/removing a non-existing element)
em.getTransaction().begin();
sse1 = em.find(EnumSetEntity.class, sse1.getId());
sse1.getEnums1().add(E1.Y);
sse1.getEnums2().remove(E2.B);
em.getTransaction().commit();
// Revision 3 (sse1: removing 1 element/adding an exisiting element)
em.getTransaction().begin();
sse1 = em.find(EnumSetEntity.class, sse1.getId());
sse1.getEnums1().remove(E1.X);
sse1.getEnums2().add(E2.A);
em.getTransaction().commit();
//
sse1_id = sse1.getId();
}
Aggregations