Package org.apache.openjpa.persistence

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


        pc2.setName("changed2");
        endTx(pm);
        assertEquals(2, pc.getVersion());
        assertEquals(2, pc2.getVersion());
        ValueStrategyPC detached = (ValueStrategyPC) pm.detachCopy(pc);
        ValueStrategyPC detached2 = (ValueStrategyPC) pm.detachCopy(pc2);
        endEm(pm);

        // clean attach
        pm = (OpenJPAEntityManager) currentEntityManager();
        startTx(pm);
View Full Code Here


        owner = (DependentFieldsPC) pm.find(DependentFieldsPC.class, oid);
        if (mapped)
            assertEquals(2, owner.getDependentMappedList().size());
        else
            assertEquals(2, owner.getDependentInverseKeyList().size());
        DependentFieldsPC detached = (DependentFieldsPC) pm.detachCopy(owner);
        endEm(pm);

        if (mapped) {
            assertEquals(2, detached.getDependentMappedList().size());
            detached.getDependentMappedList().clear();
View Full Code Here

    public void testDetachCopy() {
        OpenJPAEntityManager em = emf.createEntityManager();
        LRSEntity lrs = em.find(LRSEntity.class, id);
        assertLRS(lrs, "lrs");
        lrs = em.detachCopy(lrs);
        assertEquals("lrs", lrs.getName());
        assertNull(lrs.getLRSList());
        em.close();
        assertMerge(lrs);
    }
View Full Code Here

        assertTrue(em.contains(e20));
        assertFalse(em.isDetached(e20));
        verifySerializable(e20, true, false);
       
        // Test new detachCopy() method added in 2.0.0
        Entity20 e20copy = em.detachCopy(e20);
        if (log.isTraceEnabled())
            log.trace("** after detachCopy");
        // verify e20 is same as above
        assertTrue(em.contains(e20));
        assertFalse(em.isDetached(e20));
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.