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(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

        emf.addLifecycleListener(lifeListener, null);

        OpenJPAEntityManager em = emf.createEntityManager();
        T t = em.find(getManagedType(), id);
        assertEquals(0, lifeListener.refreshCount);
        em.refresh(t);
        assertEquals(1*graphSize(), lifeListener.refreshCount);
        em.getTransaction().begin();
        em.getTransaction().commit();
        em.getTransaction().begin();
        em.getTransaction().commit();
View Full Code Here

        assertNotNull(deserializedLifeListener);
        assertEquals(1* graphSize(),
            deserializedLifeListener.refreshCount);
        assertNotSame(lifeListener, deserializedLifeListener);
        T t2 = em2.find(getManagedType(), id);
        em2.refresh(t2);
        assertEquals(2* graphSize(),
            deserializedLifeListener.refreshCount);

        // if this is 3*refreshMultiplier(), that means that there are
        // extra registered listeners
View Full Code Here

        assertNotCached(Item.class, id);

        fItem.setItemData(updatedKey);
        assertEquals(updatedKey, fItem.getItemData());

        em.refresh(fItem, paramProperties);
        assertEquals(key, fItem.getItemData());
        assertNotCached(Item.class, id);

        Object mode = em.getProperties().get(JPAProperties.CACHE_STORE_MODE);
        assertEquals(mode, CacheStoreMode.USE);       
View Full Code Here

        emf.addLifecycleListener(lifeListener, null);

        OpenJPAEntityManager em = emf.createEntityManager();
        T t = em.find(getManagedType(), id);
        assertEquals(0, lifeListener.refreshCount);
        em.refresh(t);
        assertEquals(1*graphSize(), lifeListener.refreshCount);
        em.getTransaction().begin();
        em.getTransaction().commit();
        em.getTransaction().begin();
        em.getTransaction().commit();
View Full Code Here

        assertNotNull(deserializedLifeListener);
        assertEquals(1* graphSize(),
            deserializedLifeListener.refreshCount);
        assertNotSame(lifeListener, deserializedLifeListener);
        T t2 = em2.find(getManagedType(), id);
        em2.refresh(t2);
        assertEquals(2* graphSize(),
            deserializedLifeListener.refreshCount);

        // if this is 3*refreshMultiplier(), that means that there are
        // extra registered listeners
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 ());
         assertNotNull (rel.getDependent ());
         endTx(em);
         endEm(em);
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", CallbackStorage.getInstance().getClist().get(0));
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.