Search in sources :

Example 1 with Address

use of org.hibernate.envers.test.integration.inheritance.joined.notownedrelation.Address 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();
}
Also used : EntityManager(javax.persistence.EntityManager) Address(org.hibernate.envers.test.integration.inheritance.joined.notownedrelation.Address) PersonalContact(org.hibernate.envers.test.integration.inheritance.joined.notownedrelation.PersonalContact) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Aggregations

EntityManager (javax.persistence.EntityManager)1 Priority (org.hibernate.envers.test.Priority)1 Address (org.hibernate.envers.test.integration.inheritance.joined.notownedrelation.Address)1 PersonalContact (org.hibernate.envers.test.integration.inheritance.joined.notownedrelation.PersonalContact)1 Test (org.junit.Test)1