Package org.hibernate.envers.test.entities.manytomany.unidirectional

Examples of org.hibernate.envers.test.entities.manytomany.unidirectional.M2MIndexedListTargetNotAuditedEntity


        em.getTransaction().begin();

        uste1 = em.find(UnversionedStrTestEntity.class, uste1.getId());
        uste2 = em.find(UnversionedStrTestEntity.class, uste2.getId());

        M2MIndexedListTargetNotAuditedEntity itnae1 = new M2MIndexedListTargetNotAuditedEntity(1, "tnae1");

        itnae1.getReferences().add(uste1);
        itnae1.getReferences().add(uste2);

        em.persist(itnae1);

        em.getTransaction().commit();

        // Revision 2
        em.getTransaction().begin();

        M2MIndexedListTargetNotAuditedEntity itnae2 = new M2MIndexedListTargetNotAuditedEntity(2, "tnae2");

        itnae2.getReferences().add(uste2);

        em.persist(itnae2);

        em.getTransaction().commit();

        // Revision 3
        em.getTransaction().begin();

        itnae1.getReferences().set(0, uste2);
        itnae1.getReferences().set(1, uste1);
        em.getTransaction().commit();

        itnae1_id = itnae1.getId();
        itnae2_id = itnae2.getId();
    }
View Full Code Here


        assertEquals(revisions, Arrays.asList(2));
  }

    @Test
    public void testHistory1() throws Exception {
        M2MIndexedListTargetNotAuditedEntity rev1 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae1_id, 1);
        M2MIndexedListTargetNotAuditedEntity rev2 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae1_id, 2);
        M2MIndexedListTargetNotAuditedEntity rev3 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae1_id, 3);

        assertTrue(checkList(rev1.getReferences(), uste1, uste2));
        assertTrue(checkList(rev2.getReferences(), uste1, uste2));
        assertTrue(checkList(rev3.getReferences(), uste2, uste1));
    }
View Full Code Here

        assertTrue(checkList(rev3.getReferences(), uste2, uste1));
    }

    @Test
    public void testHistory2() throws Exception {
        M2MIndexedListTargetNotAuditedEntity rev1 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae2_id, 1);
        M2MIndexedListTargetNotAuditedEntity rev2 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae2_id, 2);
        M2MIndexedListTargetNotAuditedEntity rev3 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae2_id, 3);

        assertNull(rev1);
        assertTrue(checkList(rev2.getReferences(), uste2));
        assertTrue(checkList(rev3.getReferences(), uste2));
    }
View Full Code Here

TOP

Related Classes of org.hibernate.envers.test.entities.manytomany.unidirectional.M2MIndexedListTargetNotAuditedEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.