Search in sources :

Example 1 with ParametrizedCustomTypeEntity

use of org.hibernate.envers.test.entities.customtype.ParametrizedCustomTypeEntity 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 2 with ParametrizedCustomTypeEntity

use of org.hibernate.envers.test.entities.customtype.ParametrizedCustomTypeEntity in project hibernate-orm by hibernate.

the class ParametrizedCustom method testHistoryOfCcte.

@Test
public void testHistoryOfCcte() {
    ParametrizedCustomTypeEntity rev1 = getAuditReader().find(ParametrizedCustomTypeEntity.class, pcte_id, 1);
    ParametrizedCustomTypeEntity rev2 = getAuditReader().find(ParametrizedCustomTypeEntity.class, pcte_id, 2);
    assert "xUy".equals(rev1.getStr());
    assert "xVy".equals(rev2.getStr());
}
Also used : ParametrizedCustomTypeEntity(org.hibernate.envers.test.entities.customtype.ParametrizedCustomTypeEntity) Test(org.junit.Test)

Aggregations

ParametrizedCustomTypeEntity (org.hibernate.envers.test.entities.customtype.ParametrizedCustomTypeEntity)2 Test (org.junit.Test)2 EntityManager (javax.persistence.EntityManager)1 Priority (org.hibernate.envers.test.Priority)1