Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManager.refresh()


        try {
            pm2.getTransaction().commit();
            fail("Should have caused OL exception.");
        } catch (Exception jfe) {
            pm2.getTransaction().begin();
            pm2.refresh(pc2);
            pc2.setIntField(4);
            pm2.getTransaction().commit();
        }
       
        // make sure the next transaction works too
View Full Code Here


        try {
            pm2.getTransaction().commit();
            fail("Should have caused OL exception.");
        } catch (Exception jfe) {
            pm2.getTransaction().begin();
            pm2.refresh(pc2);
            pc2.setIntField(7);
            pm2.getTransaction().commit();
        }
        pm1.close();
        pm2.close();
View Full Code Here

        try {
            pm2.getTransaction().commit();
            fail("Should have caused OL exception.");
        } catch (Exception jfe) {
            pm2.getTransaction().begin();
            pm2.refresh(pc2);
            pm2.remove(pc2);
            pm2.getTransaction().commit();
        }
    }
   
View Full Code Here

        try {
            pm2.getTransaction().commit();
            fail("Should have caused OL exception.");
        } catch (Exception jfe) {
            pm2.getTransaction().begin();
            pm2.refresh(pc2);
            pc2.setStringField("changed2");
            pm2.getTransaction().commit();
        }
        pm1.close();
        pm2.close();
View Full Code Here

        assertEquals(1, updatedEntities);

        endTx(em);

        RuntimeTest1 ret2 = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        em.refresh(ret2);

        assertNotNull(ret2);
        assertEquals("runner13", ret2.getStringField());

        endEm(em);
View Full Code Here

        em = (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        RuntimeTest1 inst = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        em.refresh(inst);

        assertNotNull(inst);
        assertEquals("upd", inst.getStringField());

        endTx(em);
View Full Code Here

        // re-retrieve and check set
        pm = getPM(true, false);
        startTx(pm);
        pc = pm.find(ProxiesPC.class, _oid);
        pm.refresh(pc);

        set = pc.getProxySet();
        assertEquals(3, set.size());
        itr = set.iterator();
        set1 = (ProxiesPC) itr.next();
View Full Code Here

        // re-retrieve and check map
        pm = getPM(false, false);
        pc = pm.find(ProxiesPC.class, _oid);
        startTx(pm);
        pm.refresh(pc);

        map = pc.getProxyMap();

        assertEquals(4, map.size());
        assertEquals("map1b", ((ProxiesPC) map.get("key1")).getName());
View Full Code Here

         assertNull (rel.getDependent ());
         ent.setDependent (new CascadesEntity ());
         rel.setDependent (new CascadesEntity ());
         em.persist (ent.getDependent ());
         em.persist (rel.getDependent ());
         em.refresh (ent);
         assertNull (ent.getDependent ());
         assertNull (rel.getDependent ());
         endTx(em);
         endEm(em);
View Full Code Here

        endTx(pm);
        assertEquals(2, pc.getVersion());

        // clean refresh
        startTx(pm);
        pm.refresh(pc);
        assertEquals(2, pc.getVersion());

        // concurrent mod
        OpenJPAEntityManager pm2 =
            (OpenJPAEntityManager) currentEntityManager();
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.