use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class EmbeddableWithDeclaredDataTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
EntityWithEmbeddableWithDeclaredData entity = new EntityWithEmbeddableWithDeclaredData();
entity.setName("Entity 1");
entity.setValue(new EmbeddableWithDeclaredData(42, "TestCodeart"));
EntityTransaction tx = em.getTransaction();
tx.begin();
em.persist(entity);
tx.commit();
em.close();
id = entity.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class NotAuditedManyToOneInComponent method initData.
@Test
@Priority(10)
public void initData() {
// No revision
EntityManager em = getEntityManager();
em.getTransaction().begin();
UnversionedStrTestEntity ste1 = new UnversionedStrTestEntity();
ste1.setStr("str1");
UnversionedStrTestEntity ste2 = new UnversionedStrTestEntity();
ste2.setStr("str2");
em.persist(ste1);
em.persist(ste2);
em.getTransaction().commit();
// Revision 1
em = getEntityManager();
em.getTransaction().begin();
NotAuditedManyToOneComponentTestEntity mtocte1 = new NotAuditedManyToOneComponentTestEntity(new NotAuditedManyToOneComponent(ste1, "data1"));
em.persist(mtocte1);
em.getTransaction().commit();
// No revision
em = getEntityManager();
em.getTransaction().begin();
mtocte1 = em.find(NotAuditedManyToOneComponentTestEntity.class, mtocte1.getId());
mtocte1.getComp1().setEntity(ste2);
em.getTransaction().commit();
// Revision 2
em = getEntityManager();
em.getTransaction().begin();
mtocte1 = em.find(NotAuditedManyToOneComponentTestEntity.class, mtocte1.getId());
mtocte1.getComp1().setData("data2");
em.getTransaction().commit();
mtocte_id1 = mtocte1.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class CompositeCustom method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
CompositeCustomTypeEntity ccte = new CompositeCustomTypeEntity();
// Revision 1 (persisting 1 entity)
em.getTransaction().begin();
ccte.setComponent(new Component("a", 1));
em.persist(ccte);
em.getTransaction().commit();
// Revision 2 (changing the component)
em.getTransaction().begin();
ccte = em.find(CompositeCustomTypeEntity.class, ccte.getId());
ccte.getComponent().setProp1("b");
em.getTransaction().commit();
// Revision 3 (replacing the component)
em.getTransaction().begin();
ccte = em.find(CompositeCustomTypeEntity.class, ccte.getId());
ccte.setComponent(new Component("c", 3));
em.getTransaction().commit();
//
ccte_id = ccte.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class DoubleFlushAddDel method initData.
@Test
@Priority(10)
public void initData() {
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
StrTestEntity fe = new StrTestEntity("x");
em.persist(fe);
em.flush();
em.remove(em.find(StrTestEntity.class, fe.getId()));
em.flush();
em.getTransaction().commit();
//
id = fe.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class DoubleFlushAddMod method initData.
@Test
@Priority(10)
public void initData() {
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
StrTestEntity fe = new StrTestEntity("x");
em.persist(fe);
em.flush();
fe.setStr("y");
em.flush();
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
fe = em.find(StrTestEntity.class, fe.getId());
fe.setStr("z");
em.flush();
em.getTransaction().commit();
//
id = fe.getId();
}
Aggregations