Search in sources :

Example 11 with Priority

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

the class CollectionOfMappedSuperclassComponentsTest method initData.

@Test
@Priority(10)
public void initData() {
    // Revision 1
    EntityManager em = getEntityManager();
    em.getTransaction().begin();
    MappedSuperclassComponentSetTestEntity cte1 = new MappedSuperclassComponentSetTestEntity();
    em.persist(cte1);
    em.getTransaction().commit();
    // Revision 2
    em = getEntityManager();
    em.getTransaction().begin();
    cte1 = em.find(MappedSuperclassComponentSetTestEntity.class, cte1.getId());
    cte1.getComps().add(new Code(1));
    cte1.getCompsNotAudited().add(new Code(100));
    em.getTransaction().commit();
    id1 = cte1.getId();
}
Also used : EntityManager(javax.persistence.EntityManager) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 12 with Priority

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

the class EnumTypeTest method initData.

@Test
@Priority(10)
public void initData() {
    EntityManager em = getEntityManager();
    em.getTransaction().begin();
    EnumTypeEntity entity = new EnumTypeEntity(EnumTypeEntity.E1.X, EnumTypeEntity.E2.A);
    em.persist(entity);
    em.getTransaction().commit();
    em.close();
}
Also used : EntityManager(javax.persistence.EntityManager) EnumTypeEntity(org.hibernate.envers.test.entities.customtype.EnumTypeEntity) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 13 with Priority

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

the class ParametrizedCustom method initData.

@Test
@Priority(10)
public void initData() {
    EntityManager em = getEntityManager();
    ParametrizedCustomTypeEntity pcte = new ParametrizedCustomTypeEntity();
    // Revision 1 (persisting 1 entity)
    em.getTransaction().begin();
    pcte.setStr("U");
    em.persist(pcte);
    em.getTransaction().commit();
    // Revision 2 (changing the value)
    em.getTransaction().begin();
    pcte = em.find(ParametrizedCustomTypeEntity.class, pcte.getId());
    pcte.setStr("V");
    em.getTransaction().commit();
    //
    pcte_id = pcte.getId();
}
Also used : ParametrizedCustomTypeEntity(org.hibernate.envers.test.entities.customtype.ParametrizedCustomTypeEntity) EntityManager(javax.persistence.EntityManager) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 14 with Priority

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

the class UnspecifiedEnumTypeTest method prepareSchema.

@Test
@Priority(10)
public void prepareSchema() {
    Session session = openSession();
    dropSchema(session);
    createSchema(session);
    session.close();
}
Also used : Session(org.hibernate.Session) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 15 with Priority

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

the class UnspecifiedEnumTypeTest method testEnumRepresentation.

@Test
@Priority(6)
public void testEnumRepresentation() {
    Session session = getSession();
    List<Object[]> values = session.createSQLQuery("SELECT enum1, enum2 FROM enum_entity_aud ORDER BY rev ASC").list();
    session.close();
    Assert.assertNotNull(values);
    Assert.assertEquals(2, values.size());
    Assert.assertArrayEquals(new Object[] { 0, 0 }, values.get(0));
    Assert.assertArrayEquals(new Object[] { 1, 1 }, values.get(1));
}
Also used : Session(org.hibernate.Session) 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