use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class HasChangedNotOwnedBidirectional method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
pc_id = 1l;
a1_id = 10l;
a2_id = 100l;
// Rev 1
em.getTransaction().begin();
PersonalContact pc = new PersonalContact(pc_id, "e", "f");
Address a1 = new Address(a1_id, "a1");
a1.setContact(pc);
em.persist(pc);
em.persist(a1);
em.getTransaction().commit();
// Rev 2
em.getTransaction().begin();
pc = em.find(PersonalContact.class, pc_id);
Address a2 = new Address(a2_id, "a2");
a2.setContact(pc);
em.persist(a2);
em.getTransaction().commit();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class MultipleAssociationsTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
Person lukasz = new Person("Lukasz");
Person kinga = new Person("Kinga");
Address warsaw = new Address("Warsaw");
warsaw.getTenants().add(lukasz);
warsaw.setLandlord(lukasz);
warsaw.getTenants().add(kinga);
lukasz.getAddresses().add(warsaw);
lukasz.getOwnedAddresses().add(warsaw);
kinga.getAddresses().add(warsaw);
em.persist(lukasz);
em.persist(kinga);
em.persist(warsaw);
em.getTransaction().commit();
lukaszId = lukasz.getId();
kingaId = kinga.getId();
warsawId = warsaw.getId();
// Revision 2
em.getTransaction().begin();
kinga = em.find(Person.class, kinga.getId());
Address cracow = new Address("Cracow");
kinga.getAddresses().add(cracow);
cracow.getTenants().add(kinga);
cracow.setLandlord(kinga);
em.persist(cracow);
em.getTransaction().commit();
cracowId = cracow.getId();
// Revision 3
em.getTransaction().begin();
cracow = em.find(Address.class, cracow.getId());
cracow.setCity("Krakow");
em.merge(cracow);
em.getTransaction().commit();
// Revision 4
em.getTransaction().begin();
lukasz = em.find(Person.class, lukasz.getId());
lukasz.setName("Lucas");
em.merge(lukasz);
em.getTransaction().commit();
// Revision 5
em.getTransaction().begin();
warsaw = em.find(Address.class, warsaw.getId());
lukasz = em.find(Person.class, lukasz.getId());
kinga = em.find(Person.class, kinga.getId());
warsaw.setLandlord(kinga);
kinga.getOwnedAddresses().add(warsaw);
lukasz.getOwnedAddresses().remove(warsaw);
em.merge(warsaw);
em.merge(lukasz);
em.merge(kinga);
em.getTransaction().commit();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class AuditColumnNameTest method initData.
@Test
@Priority(10)
public void initData() {
NamingTestEntity2 nte1 = new NamingTestEntity2("data1");
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(nte1);
em.getTransaction().commit();
this.id = nte1.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class EstonianTableAlias method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
Parent parent = new Parent("parent");
Child child = new Child("child");
parent.getCollection().add(child);
em.persist(child);
em.persist(parent);
em.getTransaction().commit();
parentId = parent.getId();
childId = child.getId();
}
use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.
the class OneToManyUnidirectionalNaming method initData.
@Test
@Priority(10)
public void initData() {
DetachedNamingTestEntity uni1 = new DetachedNamingTestEntity(1, "data1");
StrTestEntity str1 = new StrTestEntity("str1");
// Revision 1
EntityManager em = getEntityManager();
em.getTransaction().begin();
uni1.setCollection(new HashSet<StrTestEntity>());
em.persist(uni1);
em.persist(str1);
em.getTransaction().commit();
// Revision 2
em.getTransaction().begin();
uni1 = em.find(DetachedNamingTestEntity.class, uni1.getId());
str1 = em.find(StrTestEntity.class, str1.getId());
uni1.getCollection().add(str1);
em.getTransaction().commit();
//
uni1_id = uni1.getId();
str1_id = str1.getId();
}
Aggregations