Examples of StrIntTestEntity


Examples of org.hibernate.envers.test.entities.StrIntTestEntity

    @BeforeClass(dependsOnMethods = "init")
    public void initData() {
        // Revision 1
        EntityManager em = getEntityManager();
        em.getTransaction().begin();
        StrIntTestEntity nullSite = new StrIntTestEntity(null, 1);
        StrIntTestEntity notNullSite = new StrIntTestEntity("data", 2);
        em.persist(nullSite);
        em.persist(notNullSite);
        idSimplePropertyNull = nullSite.getId();
        idSimplePropertyNotNull = notNullSite.getId();
        em.getTransaction().commit();

        // Revision 2
        em.getTransaction().begin();
        SetRefIngEmbIdEntity nullParentSrieie = new SetRefIngEmbIdEntity(idMulticolumnReferenceToParentNull, "data", null);
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

        em.getTransaction().commit();
    }

    @Test
    public void testSimplePropertyIsNullQuery() {
        StrIntTestEntity ver = (StrIntTestEntity) getAuditReader().createQuery()
                .forEntitiesAtRevision(StrIntTestEntity.class, 1)
                .add(AuditEntity.property("str1").isNull())
                .getSingleResult();

        assert ver.equals(new StrIntTestEntity(null, 1, idSimplePropertyNull));
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

        assert ver.equals(new StrIntTestEntity(null, 1, idSimplePropertyNull));
    }

    @Test
    public void testSimplePropertyIsNotNullQuery() {
        StrIntTestEntity ver = (StrIntTestEntity) getAuditReader().createQuery()
                .forEntitiesAtRevision(StrIntTestEntity.class, 1)
                .add(AuditEntity.property("str1").isNotNull())
                .getSingleResult();

        assert ver.equals(new StrIntTestEntity("data", 2, idSimplePropertyNotNull));
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

    public void initData() {
        // Revision 1
        EntityManager em = getEntityManager();
        em.getTransaction().begin();

        StrIntTestEntity site1 = new StrIntTestEntity("a", 10);
        StrIntTestEntity site2 = new StrIntTestEntity("b", 15);

        em.persist(site1);
        em.persist(site2);

        id1 = site1.getId();
        Integer id2 = site2.getId();

        em.getTransaction().commit();

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

        site1 = em.find(StrIntTestEntity.class, id1);
        site2 = em.find(StrIntTestEntity.class, id2);

        site1.setStr1("d");
        site2.setNumber(20);

        em.getTransaction().commit();

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

        site1 = em.find(StrIntTestEntity.class, id1);
        site2 = em.find(StrIntTestEntity.class, id2);

        site1.setNumber(1);
        site2.setStr1("z");

        em.getTransaction().commit();

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

        site1 = em.find(StrIntTestEntity.class, id1);
        site2 = em.find(StrIntTestEntity.class, id2);

        site1.setNumber(5);
        site2.setStr1("a");

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

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

                .add(AuditEntity.id().eq(id1))
                .add(AuditEntity.revisionType().eq(RevisionType.MOD))
                .getResultList();
       
        assert results.size() == 3;
        assert results.get(0).equals(new StrIntTestEntity("d", 10, id1));
        assert results.get(1).equals(new StrIntTestEntity("d", 1, id1));
        assert results.get(2).equals(new StrIntTestEntity("d", 5, id1));
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

                .add(AuditEntity.id().eq(id1))
                .add(AuditEntity.revisionType().ne(RevisionType.MOD))
                .getResultList();

        assert results.size() == 1;
        assert results.get(0).equals(new StrIntTestEntity("a", 10, id1));
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

    public void initData() {
        // Revision 1
        EntityManager em = getEntityManager();
        em.getTransaction().begin();

        StrIntTestEntity site1 = new StrIntTestEntity("a", 10);
        StrIntTestEntity site2 = new StrIntTestEntity("a", 10);
        StrIntTestEntity site3 = new StrIntTestEntity("b", 5);

        em.persist(site1);
        em.persist(site2);
        em.persist(site3);

        id1 = site1.getId();
        id2 = site2.getId();
        id3 = site3.getId();

        em.getTransaction().commit();

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

        site1 = em.find(StrIntTestEntity.class, id1);
        site2 = em.find(StrIntTestEntity.class, id2);

        site1.setStr1("c");
        site2.setNumber(20);

        em.getTransaction().commit();

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

        site3 = em.find(StrIntTestEntity.class, id3);

        site3.setStr1("a");

        em.getTransaction().commit();

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

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

        em.getTransaction().commit();
    }

    @Test
    public void testEntitiesIdQuery() {
        StrIntTestEntity ver2 = (StrIntTestEntity) getAuditReader().createQuery()
                .forEntitiesAtRevision(StrIntTestEntity.class, 2)
                .add(AuditEntity.id().eq(id2))
                .getSingleResult();

        assert ver2.equals(new StrIntTestEntity("a", 20, id2));
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

        List ver3 = getAuditReader().createQuery()
                .forEntitiesAtRevision(StrIntTestEntity.class, 3)
                .add(AuditEntity.property("str1").eq("a"))
                .getResultList();

        assert new HashSet(ver1).equals(TestTools.makeSet(new StrIntTestEntity("a", 10, id1),
                new StrIntTestEntity("a", 10, id2)));
        assert new HashSet(ver2).equals(TestTools.makeSet(new StrIntTestEntity("a", 20, id2)));
        assert new HashSet(ver3).equals(TestTools.makeSet(new StrIntTestEntity("a", 20, id2),
                new StrIntTestEntity("a", 5, id3)));
    }
View Full Code Here

Examples of org.hibernate.envers.test.entities.StrIntTestEntity

        List ver3 = getAuditReader().createQuery()
                .forEntitiesAtRevision(StrIntTestEntity.class, 3)
                .add(AuditEntity.property("number").le(10))
                .getResultList();

        assert new HashSet(ver1).equals(TestTools.makeSet(new StrIntTestEntity("a", 10, id1),
                new StrIntTestEntity("a", 10, id2), new StrIntTestEntity("b", 5, id3)));
        assert new HashSet(ver2).equals(TestTools.makeSet(new StrIntTestEntity("c", 10, id1),
                new StrIntTestEntity("b", 5, id3)));
        assert new HashSet(ver3).equals(TestTools.makeSet(new StrIntTestEntity("c", 10, id1),
                new StrIntTestEntity("a", 5, id3)));
    }
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.