Package org.apache.openjpa.persistence

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


    }

    public void testDetachNoOverwrite() {
        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);
        b = (AttachB) pm.detachCopy(b);
        endEm(pm);

        b.setBstr("12");

        pm = getPM();
View Full Code Here


        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);

        assertNotNull("b is null in testOptimisticLock", b);

        b = (AttachB) pm.detachCopy(b);
        endEm(pm);

        b.setAint(12);
        b.setBstr("12");
        TreeMap map = new TreeMap();
View Full Code Here

        AttachD d = pm.find(AttachD.class, doid);

        assertNotNull("d is null in testEmbedded", d);

        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detachCopy(d);
        endEm(pm);

        d.getEmbeddedE().setEstr("E12");
        pm = getPM();
        startTx(pm);
View Full Code Here

        OpenJPAEntityManager pm = getPM();
        AttachD d = (AttachD) pm.find(AttachD.class, doid);

        assertNotNull("d is null in testNullEmbedded", d);
        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detachCopy(d);
        endEm(pm);

        d.setEmbeddedE(null);
        pm = getPM();
        startTx(pm);
View Full Code Here

        AttachD d = (AttachD) pm.find(AttachD.class, doid);

        assertNotNull("d is null in testNullEmbeddedRelated", d);

        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detachCopy(d);
        endEm(pm);

        d.getEmbeddedE().setEstr(null);
        pm = getPM();
        startTx(pm);
View Full Code Here

    public void testNullCollection() {
        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);
        b.getDs();
        b = (AttachB) pm.detachCopy(b);
        endEm(pm);

        assertEquals(1, b.getDs().size());
        b.setDs(null);
View Full Code Here

        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);

        assertNotNull("b is null in doCollectionTest", b);
        b.getDs();
        b = (AttachB) pm.detachCopy(b);
        endEm(pm);

        assertEquals("b is null in doCollectionTest", 1, b.getDs().size());
        if (remove) {
            for (Iterator it = b.getDs().iterator(); it.hasNext();) {
View Full Code Here

        pm = (OpenJPAEntityManager) factory.createEntityManager();
        pc = (DetachSMPC) pm.find(DetachSMPC.class, pcoid);
        pc.getRelSet();
        pc.getStringIntMap();
        if (!auto) {
            pc = (DetachSMPC) pm.detachCopy(pc);
            assertDetachedSM(pc);
        }
        pc = (DetachSMPC) roundtrip(pc, false);
        assertDetachedSM(pc);
        endEm(pm);
View Full Code Here

        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        ManagedIface pcx = em.find(ManagedIface.class, oid);
        pc = em.detachCopy(pcx);
        em.close();

        assertTrue(em.isDetached(pc));
        pc.setIntField(7);
View Full Code Here

        pc.setName("changed");
        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();
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.