use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class QueryingWithProxyObjectTest method initData.
@Test
@Priority(10)
public void initData() {
// Revision 1
getSession().getTransaction().begin();
StrTestEntity ste = new StrTestEntity("data");
getSession().persist(ste);
getSession().getTransaction().commit();
id = ste.getId();
getSession().close();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class OutsideTransactionTest method testInsertOutsideActiveTransaction.
@Test(expected = TransactionRequiredException.class)
public void testInsertOutsideActiveTransaction() {
Session session = openSession();
// Illegal insertion of entity outside of active transaction.
StrTestEntity entity = new StrTestEntity("data");
session.persist(entity);
session.flush();
session.close();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class OutsideTransactionTest method testDeleteOutsideActiveTransaction.
@Test(expected = TransactionRequiredException.class)
public void testDeleteOutsideActiveTransaction() {
Session session = openSession();
// Revision 1
session.getTransaction().begin();
StrTestEntity entity = new StrTestEntity("data");
session.persist(entity);
session.getTransaction().commit();
// Illegal removal of entity outside of active transaction.
session.delete(entity);
session.flush();
session.close();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class OutsideTransactionTest method testUpdateOutsideActiveTransaction.
@Test(expected = TransactionRequiredException.class)
public void testUpdateOutsideActiveTransaction() {
Session session = openSession();
// Revision 1
session.getTransaction().begin();
StrTestEntity entity = new StrTestEntity("data");
session.persist(entity);
session.getTransaction().commit();
// Illegal modification of entity state outside of active transaction.
entity.setStr("modified data");
session.update(entity);
session.flush();
session.close();
}
use of org.hibernate.envers.test.entities.StrTestEntity in project hibernate-orm by hibernate.
the class BasicDetachedList method testHistoryOfColl1.
@Test
public void testHistoryOfColl1() {
StrTestEntity str1 = getEntityManager().find(StrTestEntity.class, str1_id);
StrTestEntity str2 = getEntityManager().find(StrTestEntity.class, str2_id);
ListRefCollEntity rev1 = getAuditReader().find(ListRefCollEntity.class, coll1_id, 1);
ListRefCollEntity rev2 = getAuditReader().find(ListRefCollEntity.class, coll1_id, 2);
ListRefCollEntity rev3 = getAuditReader().find(ListRefCollEntity.class, coll1_id, 3);
ListRefCollEntity rev4 = getAuditReader().find(ListRefCollEntity.class, coll1_id, 4);
assert TestTools.checkCollection(rev1.getCollection(), str1);
assert TestTools.checkCollection(rev2.getCollection(), str1, str2);
assert TestTools.checkCollection(rev3.getCollection(), str2);
assert TestTools.checkCollection(rev4.getCollection());
assert "coll1".equals(rev1.getData());
assert "coll1".equals(rev2.getData());
assert "coll1".equals(rev3.getData());
assert "coll1".equals(rev4.getData());
}
Aggregations