Search in sources :

Example 61 with StrTestEntity

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

the class SchemaExportTest method testSchemaCreation.

@Test
@Priority(10)
public void testSchemaCreation() {
    // Populate database with test data.
    Session session = getSession();
    session.getTransaction().begin();
    StrTestEntity entity = new StrTestEntity("data");
    session.save(entity);
    session.getTransaction().commit();
    id = entity.getId();
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) Session(org.hibernate.Session) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 62 with StrTestEntity

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

the class EvictAuditDataAfterCommitTest method testSessionCacheClear.

@Test
@TestForIssue(jiraKey = "HHH-6614")
public void testSessionCacheClear() {
    Session session = openSession();
    session.getTransaction().begin();
    StrTestEntity ste = new StrTestEntity("data");
    session.persist(ste);
    session.getTransaction().commit();
    checkEmptyAuditSessionCache(session, "org.hibernate.envers.test.entities.StrTestEntity_AUD");
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) Session(org.hibernate.Session) Test(org.junit.Test) TestForIssue(org.hibernate.testing.TestForIssue)

Example 63 with StrTestEntity

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

the class DifferentDBSchemaTest method testHistoryOfId1.

@Test
public void testHistoryOfId1() {
    StrTestEntity ver1 = new StrTestEntity("x", steId);
    StrTestEntity ver2 = new StrTestEntity("y", steId);
    assert getAuditReader().find(StrTestEntity.class, steId, 1).equals(ver1);
    assert getAuditReader().find(StrTestEntity.class, steId, 2).equals(ver2);
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) Test(org.junit.Test)

Example 64 with StrTestEntity

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

the class GloballyConfiguredRevListenerTest method initData.

@Test
@Priority(10)
public void initData() {
    EntityManager em = getEntityManager();
    CountingRevisionListener.revisionCount = 0;
    // Revision 1
    em.getTransaction().begin();
    StrTestEntity te = new StrTestEntity("data");
    em.persist(te);
    em.getTransaction().commit();
    Assert.assertEquals(1, CountingRevisionListener.revisionCount);
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) EntityManager(javax.persistence.EntityManager) Test(org.junit.Test) Priority(org.hibernate.envers.test.Priority)

Example 65 with StrTestEntity

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

the class Inherited method testHistoryOfId1.

@Test
public void testHistoryOfId1() {
    StrTestEntity ver1 = new StrTestEntity("x", id);
    StrTestEntity ver2 = new StrTestEntity("y", id);
    assert getAuditReader().find(StrTestEntity.class, id, 1).equals(ver1);
    assert getAuditReader().find(StrTestEntity.class, id, 2).equals(ver2);
}
Also used : StrTestEntity(org.hibernate.envers.test.entities.StrTestEntity) Test(org.junit.Test)

Aggregations

StrTestEntity (org.hibernate.envers.test.entities.StrTestEntity)103 Test (org.junit.Test)99 EntityManager (javax.persistence.EntityManager)51 Priority (org.hibernate.envers.test.Priority)48 Session (org.hibernate.Session)8 StrIntTestEntity (org.hibernate.envers.test.entities.StrIntTestEntity)8 TestForIssue (org.hibernate.testing.TestForIssue)5 ListRefCollEntity (org.hibernate.envers.test.entities.onetomany.detached.ListRefCollEntity)4 SetRefCollEntity (org.hibernate.envers.test.entities.onetomany.detached.SetRefCollEntity)4 ManyToOneComponent (org.hibernate.envers.test.entities.components.relations.ManyToOneComponent)3 ManyToOneComponentTestEntity (org.hibernate.envers.test.entities.components.relations.ManyToOneComponentTestEntity)3 OneToManyComponent (org.hibernate.envers.test.entities.components.relations.OneToManyComponent)3 OneToManyComponentTestEntity (org.hibernate.envers.test.entities.components.relations.OneToManyComponentTestEntity)3 SortedSetEntity (org.hibernate.envers.test.entities.manytomany.SortedSetEntity)3 ListUniEntity (org.hibernate.envers.test.entities.manytomany.unidirectional.ListUniEntity)3 SetUniEntity (org.hibernate.envers.test.entities.manytomany.unidirectional.SetUniEntity)3 List (java.util.List)2 RevisionType (org.hibernate.envers.RevisionType)2 JoinTableEntity (org.hibernate.envers.test.entities.manytomany.unidirectional.JoinTableEntity)2 MapUniEntity (org.hibernate.envers.test.entities.manytomany.unidirectional.MapUniEntity)2