Search in sources :

Example 76 with Priority

use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.

the class NamingSecondary method initData.

@Test
@Priority(10)
public void initData() {
    SecondaryNamingTestEntity ste = new SecondaryNamingTestEntity("a", "1");
    // Revision 1
    EntityManager em = getEntityManager();
    em.getTransaction().begin();
    em.persist(ste);
    em.getTransaction().commit();
    // Revision 2
    em.getTransaction().begin();
    ste = em.find(SecondaryNamingTestEntity.class, ste.getId());
    ste.setS1("b");
    ste.setS2("2");
    em.getTransaction().commit();
    //
    id = ste.getId();
}
Also used : EntityManager(javax.persistence.EntityManager) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 77 with Priority

use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.

the class EmbIdSecondary method initData.

@Test
@Priority(10)
public void initData() {
    id = new EmbId(1, 2);
    SecondaryEmbIdTestEntity ste = new SecondaryEmbIdTestEntity(id, "a", "1");
    // Revision 1
    EntityManager em = getEntityManager();
    em.getTransaction().begin();
    em.persist(ste);
    em.getTransaction().commit();
    // Revision 2
    em.getTransaction().begin();
    ste = em.find(SecondaryEmbIdTestEntity.class, ste.getId());
    ste.setS1("b");
    ste.setS2("2");
    em.getTransaction().commit();
}
Also used : EntityManager(javax.persistence.EntityManager) EmbId(org.hibernate.envers.test.entities.ids.EmbId) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 78 with Priority

use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.

the class MulIdSecondary method initData.

@Test
@Priority(10)
public void initData() {
    id = new MulId(1, 2);
    SecondaryMulIdTestEntity ste = new SecondaryMulIdTestEntity(id, "a", "1");
    // Revision 1
    EntityManager em = getEntityManager();
    em.getTransaction().begin();
    em.persist(ste);
    em.getTransaction().commit();
    // Revision 2
    em.getTransaction().begin();
    ste = em.find(SecondaryMulIdTestEntity.class, id);
    ste.setS1("b");
    ste.setS2("2");
    em.getTransaction().commit();
}
Also used : EntityManager(javax.persistence.EntityManager) MulId(org.hibernate.envers.test.entities.ids.MulId) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 79 with Priority

use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.

the class CustomBoxed 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();
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) EntityManager(javax.persistence.EntityManager) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 80 with Priority

use of org.hibernate.envers.test.Priority in project hibernate-orm by hibernate.

the class CustomColumnMapping 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();
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) EntityManager(javax.persistence.EntityManager) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Aggregations

Priority (org.hibernate.envers.test.Priority)268 Test (org.junit.Test)268 EntityManager (javax.persistence.EntityManager)249 StrTestEntity (org.hibernate.envers.test.entities.StrTestEntity)48 Session (org.hibernate.Session)16 StrIntTestEntity (org.hibernate.envers.test.entities.StrIntTestEntity)12 EmbId (org.hibernate.envers.test.entities.ids.EmbId)8 UnversionedStrTestEntity (org.hibernate.envers.test.entities.UnversionedStrTestEntity)7 Component1 (org.hibernate.envers.test.entities.components.Component1)7 MulId (org.hibernate.envers.test.entities.ids.MulId)7 HashSet (java.util.HashSet)6 IntTestEntity (org.hibernate.envers.test.entities.IntTestEntity)6 SetRefEdEntity (org.hibernate.envers.test.entities.onetomany.SetRefEdEntity)6 SetRefIngEntity (org.hibernate.envers.test.entities.onetomany.SetRefIngEntity)6 Component2 (org.hibernate.envers.test.entities.components.Component2)5 ComponentTestEntity (org.hibernate.envers.test.entities.components.ComponentTestEntity)4 CollectionRefEdEntity (org.hibernate.envers.test.entities.onetomany.CollectionRefEdEntity)4 CollectionRefIngEntity (org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3