Package org.apache.openjpa.persistence

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


    CallbackStorage.clearStore();

    assertTrue(CallbackStorage.getInstance().getClist().isEmpty());

    emp = em.find(Employee.class, 6);
    em.refresh(emp);

    assertNotNull(emp);
    assertNotNull(CallbackStorage.getInstance().getClist());
        assertEquals("PostLoad is overfiring...not accurate", 2,
                CallbackStorage.getInstance().getClist().size());
View Full Code Here


            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);
        NoClone orig = new NoClone("test");
        pm.persist(orig);
        endTx(pm);
        pm.refresh(orig);
        NoClone copy = orig.safeClone();
        assertEquals("test", copy.getString());
        assertTrue(pm.isPersistent(orig));
        assertFalse(pm.isPersistent(copy));
        endEm(pm);
View Full Code Here

            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);
        SubclassClone orig = new SubclassClone("test");
        pm.persist(orig);
        endTx(pm);
        pm.refresh(orig);
        SubclassClone copy = orig.safeClone();
        assertEquals("test", copy.getString());
        assertTrue(pm.isPersistent(orig));
        // this should be true since the sm should be VM copied.
        // as we intentionally don't handle this case.
View Full Code Here

            (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);
        PCClone orig = new PCClone("test");
        pm.persist(orig);
        endTx(pm);
        pm.refresh(orig);
        PCClone copy = (PCClone) orig.clone();
        assertEquals("test", copy.getString());
        assertTrue(pm.isPersistent(orig));
        assertFalse(pm.isPersistent(copy));
        endEm(pm);
View Full Code Here

    CallbackStorage.clearStore();

    assertTrue(CallbackStorage.getInstance().getClist().isEmpty());

    lcd = em.find(LifeCycleDDEntity.class, id);
    em.refresh(lcd);

    assertNotNull(lcd);
    assertNotNull(CallbackStorage.getInstance().getClist());
        assertEquals(2, CallbackStorage.getInstance().getClist().size());
        assertEquals("def-postload",
View Full Code Here

    CallbackStorage.clearStore();

    assertTrue("not empty...", CallbackStorage.isEmpty());

    emp = em.find(LifeCycleDDEntity2.class, id);
    em.refresh(emp);

    assertNotNull(emp);
    assertNotNull(CallbackStorage.getInstance().getClist());
        assertEquals(2, CallbackStorage.getInstance().getClist().size());
        assertEquals("def-postload",
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

        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

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.