Package org.hibernate.envers.test.entities.components.relations

Examples of org.hibernate.envers.test.entities.components.relations.NotAuditedManyToOneComponentTestEntity


        // Revision 1
        em = getEntityManager();
        em.getTransaction().begin();

    NotAuditedManyToOneComponentTestEntity mtocte1 = new NotAuditedManyToOneComponentTestEntity(
        new NotAuditedManyToOneComponent(ste1, "data1"));

    em.persist(mtocte1);

        em.getTransaction().commit();

        // No revision
        em = getEntityManager();
        em.getTransaction().begin();

        mtocte1 = em.find(NotAuditedManyToOneComponentTestEntity.class, mtocte1.getId());
        mtocte1.getComp1().setEntity(ste2);

        em.getTransaction().commit();

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

        mtocte1 = em.find(NotAuditedManyToOneComponentTestEntity.class, mtocte1.getId());
        mtocte1.getComp1().setData("data2");

        em.getTransaction().commit();

        mtocte_id1 = mtocte1.getId();
    }
View Full Code Here


        assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(NotAuditedManyToOneComponentTestEntity.class, mtocte_id1));
    }

    @Test
    public void testHistoryOfId1() {
    NotAuditedManyToOneComponentTestEntity ver1 = new NotAuditedManyToOneComponentTestEntity(mtocte_id1,
        new NotAuditedManyToOneComponent(null, "data1"));
    NotAuditedManyToOneComponentTestEntity ver2 = new NotAuditedManyToOneComponentTestEntity(mtocte_id1,
        new NotAuditedManyToOneComponent(null, "data2"));

        assert getAuditReader().find(NotAuditedManyToOneComponentTestEntity.class, mtocte_id1, 1).equals(ver1);
        assert getAuditReader().find(NotAuditedManyToOneComponentTestEntity.class, mtocte_id1, 2).equals(ver2);
    }
View Full Code Here

TOP

Related Classes of org.hibernate.envers.test.entities.components.relations.NotAuditedManyToOneComponentTestEntity

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.