Examples of CollectionRefIngEntity


Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

        em.getTransaction().commit();

        // Revision 3
        em.getTransaction().begin();
        CollectionRefEdEntity parent = new CollectionRefEdEntity(idParent, "data");
        CollectionRefIngEntity notNullParentCrie = new CollectionRefIngEntity(idReferenceToParentNotNull, "data", parent);
        em.persist(parent);
        em.persist(notNullParentCrie);
        em.getTransaction().commit();
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

        assert ver.getId().equals(idMulticolumnReferenceToParentNull);
    }

    @Test
    public void testReferencePropertyIsNotNullQuery() {
        CollectionRefIngEntity ver = (CollectionRefIngEntity) getAuditReader().createQuery()
                .forEntitiesAtRevision(CollectionRefIngEntity.class, 3)
                .add(AuditEntity.property("reference").isNotNull())
                .getSingleResult();

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

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

    public void initData() {
        EntityManager em = getEntityManager();

        CollectionRefEdEntity ed1 = new CollectionRefEdEntity(1, "data_ed_1");

        CollectionRefIngEntity ing1 = new CollectionRefIngEntity(3, "data_ing_1", ed1);

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

        em.persist(ed1);
        em.persist(ing1);

        em.getTransaction().commit();

        //

        ed1_id = ed1.getId();
        ing1_id = ing1.getId();
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

        ing1_id = ing1.getId();
    }

    @Test
    public void testDetach()throws Exception  {
        CollectionRefIngEntity ing1 = getEntityManager().find(CollectionRefIngEntity.class, ing1_id);
        CollectionRefEdEntity rev1 = getAuditReader().find(CollectionRefEdEntity.class, ed1_id, 1);

    // First forcing loading of the collection
    assert rev1.getReffering().size() == 1;
View Full Code Here

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

        EntityManager em = getEntityManager();

        CollectionRefEdEntity ed1 = new CollectionRefEdEntity(1, "data_ed_1");
        CollectionRefEdEntity ed2 = new CollectionRefEdEntity(2, "data_ed_2");

        CollectionRefIngEntity ing1 = new CollectionRefIngEntity(3, "data_ing_1", ed1);
        CollectionRefIngEntity ing2 = new CollectionRefIngEntity(4, "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(CollectionRefIngEntity.class, ing1.getId());
        ed2 = em.find(CollectionRefEdEntity.class, ed2.getId());

        ing1.setReference(ed2);

        em.getTransaction().commit();

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

        ing2 = em.find(CollectionRefIngEntity.class, ing2.getId());
        ed2 = em.find(CollectionRefEdEntity.class, ed2.getId());

        ing2.setReference(ed2);

        em.getTransaction().commit();

        //

        ed1_id = ed1.getId();
        ed2_id = ed2.getId();

        ing1_id = ing1.getId();
        ing2_id = ing2.getId();
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

        return ret;
    }

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

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

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

        assert rev3.getReffering().size() == 0;
    }

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

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

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

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

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

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

Examples of org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity

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

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

        assert rev1.getReference().equals(ed1);
        assert rev2.getReference().equals(ed1);
        assert rev3.getReference().equals(ed2);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.