Examples of StrTestEntity


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

            newEntityManager();
            EntityManager entityManager = getEntityManager();
           
            entityManager.getTransaction().begin();
            start();
            entityManager.persist(new StrTestEntity("x" + i));
            entityManager.getTransaction().commit();
            stop();
        }
    }
View Full Code Here

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

        Thread.sleep(100);

        // Revision 1
        EntityManager em = getEntityManager();
        em.getTransaction().begin();
        StrTestEntity te = new StrTestEntity("x");
        em.persist(te);
        id = te.getId();
        em.getTransaction().commit();

        timestamp2 = System.currentTimeMillis();

        Thread.sleep(100);

        // Revision 2
        em.getTransaction().begin();
        te = em.find(StrTestEntity.class, id);
        te.setStr("y");
        em.getTransaction().commit();

        timestamp3 = System.currentTimeMillis();
    }
View Full Code Here

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

        assert Arrays.asList(1l, 2l).equals(getAuditReader().getRevisions(StrTestEntity.class, id));
    }

    @Test
    public void testHistoryOfId1() {
        StrTestEntity ver1 = new StrTestEntity("x", id);
        StrTestEntity ver2 = new StrTestEntity("y", id);

        assert getAuditReader().find(StrTestEntity.class, id, 1l).equals(ver1);
        assert getAuditReader().find(StrTestEntity.class, id, 2l).equals(ver2);
    }
View Full Code Here

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

    public void testTransactionRollback() throws InterruptedException {
        // Trying to persist an entity - however the listener should throw an exception, so the entity
    // shouldn't be persisted
        EntityManager em = getEntityManager();
        em.getTransaction().begin();
        StrTestEntity te = new StrTestEntity("x");
        em.persist(te);
        em.getTransaction().commit();
    }
View Full Code Here

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

    protected void doTest() {
        EntityManager entityManager = getEntityManager();
        entityManager.getTransaction().begin();
        start();
        for (int i=0; i<NUMBER_INSERTS; i++) {
            entityManager.persist(new StrTestEntity("x" + i));
        }
        entityManager.getTransaction().commit();
        stop();
    }
View Full Code Here

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

    @BeforeClass(dependsOnMethods = "init")
    public void initData() throws InterruptedException {
        // Revision 1
        EntityManager em = getEntityManager();
        em.getTransaction().begin();
        StrTestEntity te = new StrTestEntity("x");
        em.persist(te);
        id = te.getId();
        em.getTransaction().commit();

        // Revision 2
        em.getTransaction().begin();
        te = em.find(StrTestEntity.class, id);
        te.setStr("y");
        em.getTransaction().commit();
    }
View Full Code Here

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

        assert Arrays.asList(1l, 2l).equals(getAuditReader().getRevisions(StrTestEntity.class, id));
    }

    @Test
    public void testHistoryOfId1() {
        StrTestEntity ver1 = new StrTestEntity("x", id);
        StrTestEntity ver2 = new StrTestEntity("y", id);

        assert getAuditReader().find(StrTestEntity.class, id, 1l).equals(ver1);
        assert getAuditReader().find(StrTestEntity.class, id, 2l).equals(ver2);
    }
View Full Code Here

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

    private void setup() {
        EntityManager entityManager = getEntityManager();
        entityManager.getTransaction().begin();

        for (int i=0; i<NUMBER_ENTITIES; i++) {
            StrTestEntity testEntity = new StrTestEntity("x" + i);
            entityManager.persist(testEntity);
            ids.add(testEntity.getId());
        }
        entityManager.getTransaction().commit();
    }
View Full Code Here

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

            EntityManager entityManager = getEntityManager();

            entityManager.getTransaction().begin();
            Integer id = ids.get(random.nextInt(NUMBER_ENTITIES));
            start();
            StrTestEntity testEntity = entityManager.find(StrTestEntity.class, id);
            testEntity.setStr("z" + i);
            entityManager.getTransaction().commit();
            stop();
        }
    }
View Full Code Here

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

        Thread.sleep(100);

        // Revision 1
        EntityManager em = getEntityManager();
        em.getTransaction().begin();
        StrTestEntity te = new StrTestEntity("x");
        em.persist(te);
        id = te.getId();
        em.getTransaction().commit();

        timestamp2 = System.currentTimeMillis();

        Thread.sleep(100);

        // Revision 2
        em.getTransaction().begin();
        te = em.find(StrTestEntity.class, id);
        te.setStr("y");
        em.getTransaction().commit();

        timestamp3 = System.currentTimeMillis();
    }
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.