use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class AggregateQuery method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
IntTestEntity ite1 = new IntTestEntity(2);
IntTestEntity ite2 = new IntTestEntity(10);
em.persist(ite1);
em.persist(ite2);
Integer id1 = ite1.getId();
Integer id2 = ite2.getId();
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
IntTestEntity ite3 = new IntTestEntity(8);
UnusualIdNamingEntity uine1 = new UnusualIdNamingEntity("id1", "data1");
em.persist(uine1);
em.persist(ite3);
ite1 = em.find(IntTestEntity.class, id1);
ite1.setNumber(0);
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
ite2 = em.find(IntTestEntity.class, id2);
ite2.setNumber(52);
em.getTransaction().commit();
em.close();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class MapsIdTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
Person personA = new Person("Peter");
Person personB = new Person("Mary");
em.persist(personA);
em.persist(personB);
Constant cons = new Constant("USD", "US Dollar");
em.persist(cons);
PersonTuple tuple1 = new PersonTuple(true, personA, personB, cons);
em.persist(tuple1);
em.getTransaction().commit();
tuple1Ver1 = new PersonTuple(tuple1.isHelloWorld(), tuple1.getPersonA(), tuple1.getPersonB(), tuple1.getConstant());
// Revision 2
em.getTransaction().begin();
cons = em.find(Constant.class, cons.getId());
Person personC1 = new Person("Lukasz");
em.persist(personC1);
PersonTuple tuple2 = new PersonTuple(true, personA, personC1, cons);
em.persist(tuple2);
em.getTransaction().commit();
tuple2Ver1 = new PersonTuple(tuple2.isHelloWorld(), tuple2.getPersonA(), tuple2.getPersonB(), tuple2.getConstant());
personCVer1 = new Person(personC1.getId(), personC1.getName());
personCVer1.getPersonBTuples().add(tuple2Ver1);
// Revision 3
em.getTransaction().begin();
tuple2 = em.find(PersonTuple.class, tuple2.getPersonTupleId());
tuple2.setHelloWorld(false);
em.merge(tuple2);
em.getTransaction().commit();
tuple2Ver2 = new PersonTuple(tuple2.isHelloWorld(), tuple2.getPersonA(), tuple2.getPersonB(), tuple2.getConstant());
// Revision 4
em.getTransaction().begin();
Person personC2 = em.find(Person.class, personC1.getId());
personC2.setName("Robert");
em.merge(personC2);
em.getTransaction().commit();
personCVer2 = new Person(personC2.getId(), personC2.getName());
personCVer2.getPersonBTuples().add(tuple2Ver1);
em.close();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class HierarchyTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
Node parent = new Node("parent", (Node) null);
Node child1 = new Node("child1", parent);
Node child2 = new Node("child2", parent);
parent.getChildren().add(child1);
parent.getChildren().add(child2);
em.persist(parent);
em.persist(child1);
em.persist(child2);
em.getTransaction().commit();
parentId = parent.getId();
child1Id = child1.getId();
child2Id = child2.getId();
// Revision 2
em.getTransaction().begin();
parent = em.find(Node.class, parent.getId());
parent.getChildren().get(0).setData("child1 modified");
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
child2 = em.find(Node.class, child2.getId());
em.remove(child2);
em.getTransaction().commit();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class Bidirectional method initData.
@Test
@Priority(10)
public void initData() {
BiRefEdEntity ed1 = new BiRefEdEntity(1, "data_ed_1");
BiRefEdEntity ed2 = new BiRefEdEntity(2, "data_ed_2");
BiRefIngEntity ing1 = new BiRefIngEntity(3, "data_ing_1");
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
ing1.setReference(ed1);
em.persist(ed1);
em.persist(ed2);
em.persist(ing1);
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
ing1 = em.find(BiRefIngEntity.class, ing1.getId());
ed2 = em.find(BiRefEdEntity.class, ed2.getId());
ing1.setReference(ed2);
em.getTransaction().commit();
//
ed1_id = ed1.getId();
ed2_id = ed2.getId();
ing1_id = ing1.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class BidirectionalEagerHbmTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
BidirectionalEagerHbmRefEdPK ed1 = new BidirectionalEagerHbmRefEdPK("data_ed_1");
BidirectionalEagerHbmRefIngPK ing1 = new BidirectionalEagerHbmRefIngPK("data_ing_1");
ing1.setReference(ed1);
em.persist(ed1);
em.persist(ing1);
em.getTransaction().commit();
refIngId1 = ing1.getId();
em.close();
}
Aggregations