use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class DoubleFlushModMod 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.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
fe = em.find(StrTestEntity.class, fe.getId());
fe.setStr("y");
em.flush();
fe.setStr("z");
em.flush();
em.getTransaction().commit();
//
id = fe.getId();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class DoubleFlushModDel 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.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
fe = em.find(StrTestEntity.class, fe.getId());
fe.setStr("y");
em.flush();
em.remove(em.find(StrTestEntity.class, fe.getId()));
em.flush();
em.getTransaction().commit();
//
id = fe.getId();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class BasicDetachedList method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
StrTestEntity str1 = new StrTestEntity("str1");
StrTestEntity str2 = new StrTestEntity("str2");
ListRefCollEntity coll1 = new ListRefCollEntity(3, "coll1");
// Revision 1
em.getTransaction().begin();
em.persist(str1);
em.persist(str2);
coll1.setCollection(new ArrayList<StrTestEntity>());
coll1.getCollection().add(str1);
em.persist(coll1);
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
str2 = em.find(StrTestEntity.class, str2.getId());
coll1 = em.find(ListRefCollEntity.class, coll1.getId());
coll1.getCollection().add(str2);
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
str1 = em.find(StrTestEntity.class, str1.getId());
coll1 = em.find(ListRefCollEntity.class, coll1.getId());
coll1.getCollection().remove(str1);
em.getTransaction().commit();
// Revision 4
em.getTransaction().begin();
coll1 = em.find(ListRefCollEntity.class, coll1.getId());
coll1.getCollection().clear();
em.getTransaction().commit();
//
str1_id = str1.getId();
str2_id = str2.getId();
coll1_id = coll1.getId();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class BasicJoinColumnSet method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
StrTestEntity str1 = new StrTestEntity("str1");
StrTestEntity str2 = new StrTestEntity("str2");
SetJoinColumnRefCollEntity coll1 = new SetJoinColumnRefCollEntity(3, "coll1");
// Revision 1
em.getTransaction().begin();
em.persist(str1);
em.persist(str2);
coll1.setCollection(new HashSet<StrTestEntity>());
coll1.getCollection().add(str1);
em.persist(coll1);
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
str2 = em.find(StrTestEntity.class, str2.getId());
coll1 = em.find(SetJoinColumnRefCollEntity.class, coll1.getId());
coll1.getCollection().add(str2);
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
str1 = em.find(StrTestEntity.class, str1.getId());
coll1 = em.find(SetJoinColumnRefCollEntity.class, coll1.getId());
coll1.getCollection().remove(str1);
em.getTransaction().commit();
// Revision 4
em.getTransaction().begin();
coll1 = em.find(SetJoinColumnRefCollEntity.class, coll1.getId());
coll1.getCollection().clear();
em.getTransaction().commit();
//
str1_id = str1.getId();
str2_id = str2.getId();
coll1_id = coll1.getId();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class BasicDetachedSet method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
StrTestEntity str1 = new StrTestEntity("str1");
StrTestEntity str2 = new StrTestEntity("str2");
SetRefCollEntity coll1 = new SetRefCollEntity(3, "coll1");
// Revision 1
em.getTransaction().begin();
em.persist(str1);
em.persist(str2);
coll1.setCollection(new HashSet<StrTestEntity>());
coll1.getCollection().add(str1);
em.persist(coll1);
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
str2 = em.find(StrTestEntity.class, str2.getId());
coll1 = em.find(SetRefCollEntity.class, coll1.getId());
coll1.getCollection().add(str2);
em.getTransaction().commit();
// Revision 3
em.getTransaction().begin();
str1 = em.find(StrTestEntity.class, str1.getId());
coll1 = em.find(SetRefCollEntity.class, coll1.getId());
coll1.getCollection().remove(str1);
em.getTransaction().commit();
// Revision 4
em.getTransaction().begin();
coll1 = em.find(SetRefCollEntity.class, coll1.getId());
coll1.getCollection().clear();
em.getTransaction().commit();
//
str1_id = str1.getId();
str2_id = str2.getId();
coll1_id = coll1.getId();
}
Aggregations