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

Examples of org.hibernate.envers.test.entities.onetomany.ids.SetRefIngEmbIdEntity


        idSimplePropertyNotNull = notNullSite.getId();
        em.getTransaction().commit();

        // Revision 2
        em.getTransaction().begin();
        SetRefIngEmbIdEntity nullParentSrieie = new SetRefIngEmbIdEntity(idMulticolumnReferenceToParentNull, "data", null);
        em.persist(nullParentSrieie);
        em.getTransaction().commit();

        // Revision 3
        em.getTransaction().begin();
View Full Code Here


        assert ver.equals(new StrIntTestEntity("data", 2, idSimplePropertyNotNull));
    }

    @Test
    public void testReferenceMulticolumnPropertyIsNullQuery() {
        SetRefIngEmbIdEntity ver = (SetRefIngEmbIdEntity) getAuditReader().createQuery()
                .forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 2)
                .add(AuditEntity.property("reference").isNull())
                .getSingleResult();

        assert ver.getId().equals(idMulticolumnReferenceToParentNull);
    }
View Full Code Here

        EntityManager em = getEntityManager();

        SetRefEdEmbIdEntity ed1 = new SetRefEdEmbIdEntity(ed1_id, "data_ed_1");
        SetRefEdEmbIdEntity ed2 = new SetRefEdEmbIdEntity(ed2_id, "data_ed_2");

        SetRefIngEmbIdEntity ing1 = new SetRefIngEmbIdEntity(ing1_id, "data_ing_1", ed1);
        SetRefIngEmbIdEntity ing2 = new SetRefIngEmbIdEntity(ing2_id, "data_ing_2", ed1);

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

        em.persist(ed1);
        em.persist(ed2);

        em.persist(ing1);
        em.persist(ing2);

        em.getTransaction().commit();

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

        ing1 = em.find(SetRefIngEmbIdEntity.class, ing1.getId());
        ed2 = em.find(SetRefEdEmbIdEntity.class, ed2.getId());

        ing1.setReference(ed2);

        em.getTransaction().commit();

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

        ing2 = em.find(SetRefIngEmbIdEntity.class, ing2.getId());
        ed2 = em.find(SetRefEdEmbIdEntity.class, ed2.getId());

        ing2.setReference(ed2);

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

        return ret;
    }

    @Test
    public void testHistoryOfEdId1() {
        SetRefIngEmbIdEntity ing1 = getEntityManager().find(SetRefIngEmbIdEntity.class, ing1_id);
        SetRefIngEmbIdEntity ing2 = getEntityManager().find(SetRefIngEmbIdEntity.class, ing2_id);

        SetRefEdEmbIdEntity rev1 = getAuditReader().find(SetRefEdEmbIdEntity.class, ed1_id, 1);
        SetRefEdEmbIdEntity rev2 = getAuditReader().find(SetRefEdEmbIdEntity.class, ed1_id, 2);
        SetRefEdEmbIdEntity rev3 = getAuditReader().find(SetRefEdEmbIdEntity.class, ed1_id, 3);
View Full Code Here

        assert rev3.getReffering().equals(Collections.EMPTY_SET);
    }

    @Test
    public void testHistoryOfEdId2() {
        SetRefIngEmbIdEntity ing1 = getEntityManager().find(SetRefIngEmbIdEntity.class, ing1_id);
        SetRefIngEmbIdEntity ing2 = getEntityManager().find(SetRefIngEmbIdEntity.class, ing2_id);

        SetRefEdEmbIdEntity rev1 = getAuditReader().find(SetRefEdEmbIdEntity.class, ed2_id, 1);
        SetRefEdEmbIdEntity rev2 = getAuditReader().find(SetRefEdEmbIdEntity.class, ed2_id, 2);
        SetRefEdEmbIdEntity rev3 = getAuditReader().find(SetRefEdEmbIdEntity.class, ed2_id, 3);
View Full Code Here

    @Test
    public void testHistoryOfEdIng1() {
        SetRefEdEmbIdEntity ed1 = getEntityManager().find(SetRefEdEmbIdEntity.class, ed1_id);
        SetRefEdEmbIdEntity ed2 = getEntityManager().find(SetRefEdEmbIdEntity.class, ed2_id);

        SetRefIngEmbIdEntity rev1 = getAuditReader().find(SetRefIngEmbIdEntity.class, ing1_id, 1);
        SetRefIngEmbIdEntity rev2 = getAuditReader().find(SetRefIngEmbIdEntity.class, ing1_id, 2);
        SetRefIngEmbIdEntity rev3 = getAuditReader().find(SetRefIngEmbIdEntity.class, ing1_id, 3);

        assert rev1.getReference().equals(ed1);
        assert rev2.getReference().equals(ed2);
        assert rev3.getReference().equals(ed2);
    }
View Full Code Here

    @Test
    public void testHistoryOfEdIng2() {
        SetRefEdEmbIdEntity ed1 = getEntityManager().find(SetRefEdEmbIdEntity.class, ed1_id);
        SetRefEdEmbIdEntity ed2 = getEntityManager().find(SetRefEdEmbIdEntity.class, ed2_id);

        SetRefIngEmbIdEntity rev1 = getAuditReader().find(SetRefIngEmbIdEntity.class, ing2_id, 1);
        SetRefIngEmbIdEntity rev2 = getAuditReader().find(SetRefIngEmbIdEntity.class, ing2_id, 2);
        SetRefIngEmbIdEntity rev3 = getAuditReader().find(SetRefIngEmbIdEntity.class, ing2_id, 3);

        assert rev1.getReference().equals(ed1);
        assert rev2.getReference().equals(ed1);
        assert rev3.getReference().equals(ed2);
    }
View Full Code Here

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

        SetRefIngEmbIdEntity refIng1 = new SetRefIngEmbIdEntity(id1, "x", null);
        SetRefIngEmbIdEntity refIng2 = new SetRefIngEmbIdEntity(id2, "y", null);

        em.persist(refIng1);
        em.persist(refIng2);

        em.getTransaction().commit();

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

        SetRefEdEmbIdEntity refEd3 = new SetRefEdEmbIdEntity(id3, "a");
        SetRefEdEmbIdEntity refEd4 = new SetRefEdEmbIdEntity(id4, "a");

        em.persist(refEd3);
        em.persist(refEd4);

        refIng1 = em.find(SetRefIngEmbIdEntity.class, id1);
        refIng2 = em.find(SetRefIngEmbIdEntity.class, id2);

        refIng1.setReference(refEd3);
        refIng2.setReference(refEd4);

        em.getTransaction().commit();

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

        refEd3 = em.find(SetRefEdEmbIdEntity.class, id3);
        refIng2 = em.find(SetRefIngEmbIdEntity.class, id2);
        refIng2.setReference(refEd3);

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

        assert rev1.equals(rev1_related);
        assert rev2.equals(rev2_related);
        assert rev3.equals(rev3_related);

        assert rev1.equals(TestTools.makeSet());
        assert rev2.equals(TestTools.makeSet(new SetRefIngEmbIdEntity(id1, "x", null)));
        assert rev3.equals(TestTools.makeSet(new SetRefIngEmbIdEntity(id1, "x", null),
                new SetRefIngEmbIdEntity(id2, "y", null)));
    }
View Full Code Here

                .forEntitiesAtRevision(SetRefIngEmbIdEntity.class, 3)
                .add(AuditEntity.relatedId("reference").eq(id4))
                .getResultList());

        assert rev1_related.equals(TestTools.makeSet());
        assert rev2_related.equals(TestTools.makeSet(new SetRefIngEmbIdEntity(id2, "y", null)));
        assert rev3_related.equals(TestTools.makeSet());
    }
View Full Code Here

TOP

Related Classes of org.hibernate.envers.test.entities.onetomany.ids.SetRefIngEmbIdEntity

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.