use of org.hibernate.envers.test.entities.customtype.UnspecifiedEnumTypeEntity in project hibernate-orm by hibernate.
the class UnspecifiedEnumTypeTest method initData.
@Test
@Priority(9)
public void initData() {
Session session = getSession();
// Revision 1
session.getTransaction().begin();
UnspecifiedEnumTypeEntity entity = new UnspecifiedEnumTypeEntity(UnspecifiedEnumTypeEntity.E1.X, UnspecifiedEnumTypeEntity.E2.A);
session.persist(entity);
session.getTransaction().commit();
id = entity.getId();
// Revision 2
session.getTransaction().begin();
entity = (UnspecifiedEnumTypeEntity) session.get(UnspecifiedEnumTypeEntity.class, entity.getId());
entity.setEnum1(UnspecifiedEnumTypeEntity.E1.Y);
entity.setEnum2(UnspecifiedEnumTypeEntity.E2.B);
session.update(entity);
session.getTransaction().commit();
session.close();
}
use of org.hibernate.envers.test.entities.customtype.UnspecifiedEnumTypeEntity in project hibernate-orm by hibernate.
the class UnspecifiedEnumTypeTest method testHistoryOfEnums.
@Test
@Priority(7)
public void testHistoryOfEnums() {
UnspecifiedEnumTypeEntity ver1 = new UnspecifiedEnumTypeEntity(UnspecifiedEnumTypeEntity.E1.X, UnspecifiedEnumTypeEntity.E2.A, id);
UnspecifiedEnumTypeEntity ver2 = new UnspecifiedEnumTypeEntity(UnspecifiedEnumTypeEntity.E1.Y, UnspecifiedEnumTypeEntity.E2.B, id);
Assert.assertEquals(ver1, getAuditReader().find(UnspecifiedEnumTypeEntity.class, id, 1));
Assert.assertEquals(ver2, getAuditReader().find(UnspecifiedEnumTypeEntity.class, id, 2));
}
Aggregations