use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class DifferentDBSchemaTest method initData.
@Test
@Priority(10)
public void initData() throws InterruptedException {
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
StrTestEntity ste = new StrTestEntity("x");
em.persist(ste);
steId = ste.getId();
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
ste = em.find(StrTestEntity.class, steId);
ste.setStr("y");
em.getTransaction().commit();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class Inherited method initData.
@Test
@Priority(10)
public void initData() throws InterruptedException {
timestamp1 = System.currentTimeMillis();
Thread.sleep(100);
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
StrTestEntity te = new StrTestEntity("x");
em.persist(te);
id = te.getId();
em.getTransaction().commit();
timestamp2 = System.currentTimeMillis();
Thread.sleep(100);
// Revision 2
em.getTransaction().begin();
te = em.find(StrTestEntity.class, id);
te.setStr("y");
em.getTransaction().commit();
timestamp3 = System.currentTimeMillis();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class SimpleQuery method initData.
@Test
@Priority(10)
public void initData() {
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
StrIntTestEntity site1 = new StrIntTestEntity("a", 10);
StrIntTestEntity site2 = new StrIntTestEntity("a", 10);
StrIntTestEntity site3 = new StrIntTestEntity("b", 5);
em.persist(site1);
em.persist(site2);
em.persist(site3);
id1 = site1.getId();
id2 = site2.getId();
id3 = site3.getId();
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
mulId1 = new MulId(1, 2);
em.persist(new MulIdTestEntity(mulId1.getId1(), mulId1.getId2(), "data"));
embId1 = new EmbId(3, 4);
em.persist(new EmbIdTestEntity(embId1, "something"));
site1 = em.find(StrIntTestEntity.class, id1);
site2 = em.find(StrIntTestEntity.class, id2);
site1.setStr1("aBc");
site2.setNumber(20);
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
site3 = em.find(StrIntTestEntity.class, id3);
site3.setStr1("a");
em.getTransaction().commit();
// Revision 4
em.getTransaction().begin();
site1 = em.find(StrIntTestEntity.class, id1);
em.remove(site1);
em.getTransaction().commit();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class StoreDeletedData method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
StrIntTestEntity site1 = new StrIntTestEntity("a", 10);
em.persist(site1);
id1 = site1.getId();
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
em.remove(site1);
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
StrIntTestEntity site2 = new StrIntTestEntity("b", 20);
em.persist(site2);
id2 = site2.getId();
StrIntTestEntity site3 = new StrIntTestEntity("c", 30);
em.persist(site3);
id3 = site3.getId();
em.getTransaction().commit();
// Revision 4
em.getTransaction().begin();
em.remove(site2);
em.remove(site3);
em.getTransaction().commit();
em.close();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class AuditedCollectionProxyTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
ListRefEdEntity listReferencedEntity1 = new ListRefEdEntity(Integer.valueOf(1), "str1");
ListRefIngEntity refingEntity1 = new ListRefIngEntity(Integer.valueOf(1), "refing1", listReferencedEntity1);
// Revision 1
em.getTransaction().begin();
em.persist(listReferencedEntity1);
em.persist(refingEntity1);
em.getTransaction().commit();
id_ListRefEdEntity1 = listReferencedEntity1.getId();
// Revision 2
ListRefIngEntity refingEntity2 = new ListRefIngEntity(Integer.valueOf(2), "refing2", listReferencedEntity1);
em.getTransaction().begin();
em.persist(refingEntity2);
em.getTransaction().commit();
}
Aggregations