Package org.hibernate.envers.test.entities.ids

Examples of org.hibernate.envers.test.entities.ids.EmbIdTestEntity


        ei = new EmbId(1, 2);

        EntityManager em = getEntityManager();
       
        // Revision 1
        EmbIdTestEntity eite = new EmbIdTestEntity(ei, "data");
        UniRefIngMulIdEntity notNullRef = new UniRefIngMulIdEntity(1, "data 1", eite);
        UniRefIngMulIdEntity nullRef = new UniRefIngMulIdEntity(2, "data 2", null);

        em.getTransaction().begin();
        em.persist(eite);
View Full Code Here


        assert nullRef.getReference() == null;
    }

    @Test
    public void testNotNullReference() {
        EmbIdTestEntity eite = getAuditReader().find(EmbIdTestEntity.class, ei, 1);
        UniRefIngMulIdEntity notNullRef = getAuditReader().find(UniRefIngMulIdEntity.class, 1, 1);
        assert notNullRef.getReference() != null;
        assert notNullRef.getReference().equals(eite);
    }
View Full Code Here

        str1_id = new EmbId(1, 2);
        str2_id = new EmbId(3, 4);

        coll1_id = new EmbId(5, 6);

        EmbIdTestEntity str1 = new EmbIdTestEntity(str1_id, "str1");
        EmbIdTestEntity str2 = new EmbIdTestEntity(str2_id, "str2");

        SetRefCollEntityEmbId coll1 = new SetRefCollEntityEmbId(coll1_id, "coll1");

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

        em.persist(str1);
        em.persist(str2);

        coll1.setCollection(new HashSet<EmbIdTestEntity>());
        coll1.getCollection().add(str1);
        em.persist(coll1);

        em.getTransaction().commit();

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

        str2 = em.find(EmbIdTestEntity.class, str2.getId());
        coll1 = em.find(SetRefCollEntityEmbId.class, coll1.getId());

        coll1.getCollection().add(str2);

        em.getTransaction().commit();
View Full Code Here

        assert Arrays.asList(1).equals(getAuditReader().getRevisions(EmbIdTestEntity.class, str2_id));
    }

    @Test
    public void testHistoryOfColl1() {
        EmbIdTestEntity str1 = getEntityManager().find(EmbIdTestEntity.class, str1_id);
        EmbIdTestEntity str2 = getEntityManager().find(EmbIdTestEntity.class, str2_id);

        SetRefCollEntityEmbId rev1 = getAuditReader().find(SetRefCollEntityEmbId.class, coll1_id, 1);
        SetRefCollEntityEmbId rev2 = getAuditReader().find(SetRefCollEntityEmbId.class, coll1_id, 2);
        SetRefCollEntityEmbId rev3 = getAuditReader().find(SetRefCollEntityEmbId.class, coll1_id, 3);
        SetRefCollEntityEmbId rev4 = getAuditReader().find(SetRefCollEntityEmbId.class, coll1_id, 4);
View Full Code Here

TOP

Related Classes of org.hibernate.envers.test.entities.ids.EmbIdTestEntity

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.