Package org.apache.openjpa.persistence

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


        assertTrue(em.isDetached(pc));
        pc.setIntField(7);

        em = emf.createEntityManager();
        em.getTransaction().begin();
        em.merge(pc);
        em.getTransaction().commit();
        em.close();

        em = emf.createEntityManager();
        pc = em.find(ManagedIface.class, oid);
View Full Code Here


        map.put("12", new Integer(12));
        b.setStringIntMap(map);

        pm = getPM();
        startTx(pm);
        AttachB attached = (AttachB) pm.merge(b);
        assertEquals(12, attached.getAint());
        assertEquals("12", attached.getBstr());
        assertNull(attached.getStringIntMap().get("12"));
        assertEquals(new Integer(5), attached.getStringIntMap().get("5"));
        endTx(pm);
View Full Code Here

        b.setBstr("12");
        b.getStringIntMap().put("12", new Integer(12));

        pm = getPM();
        startTx(pm);
        AttachB attached = (AttachB) pm.merge(b);
        assertEquals("not 12", 12, attached.getAint());
        assertEquals("not 12str", "12", attached.getBstr());
        assertEquals("not newInteger(12)", new Integer(12),
            attached.getStringIntMap().get("12"));
        assertEquals("not newInteger(5)", new Integer(5),
View Full Code Here

        pm = getPM();
        startTx(pm);
        AttachB orig = pm.find(AttachB.class, oid);
        orig.setAint(50);

        AttachB attached = (AttachB) pm.merge(b);
        assertEquals(attached, orig);
        assertEquals(50, attached.getAint());
        assertEquals("12", attached.getBstr());
        endTx(pm);
        endEm(pm);
View Full Code Here

        endEm(pm);

        pm = getPM();
        startTx(pm);
        try {
            pm.merge(b);
            endTx(pm);
            fail("OL expected.");
        } catch (Exception jove) {
            rollbackTx(pm);
        }
View Full Code Here

        endEm(pm);

        d.getEmbeddedE().setEstr("E12");
        pm = getPM();
        startTx(pm);
        AttachD d2 = (AttachD) pm.merge(d);
        assertNotEquals(d.getEmbeddedE(), d2.getEmbeddedE());
        assertEquals("E12", d2.getEmbeddedE().getEstr());
        assertEquals(5, d2.getEmbeddedE().getEint());
        endTx(pm);
        endEm(pm);
View Full Code Here

        endEm(pm);

        d.setEmbeddedE(null);
        pm = getPM();
        startTx(pm);
        AttachD d2 = (AttachD) pm.merge(d);
        assertNull(d2.getEmbeddedE());
        endTx(pm);
        endEm(pm);

        pm = getPM();
View Full Code Here

        endEm(pm);

        d.getEmbeddedE().setEstr(null);
        pm = getPM();
        startTx(pm);
        AttachD d2 = (AttachD) pm.merge(d);
        assertNull("d2.getEmbeddedE().getEstr() is not null",
            d2.getEmbeddedE().getEstr());
        assertEquals("d2.getEmbeddedE().getEint() is not equal to 5", 5,
            d2.getEmbeddedE().getEint());
        endTx(pm);
View Full Code Here

        assertEquals(1, b.getDs().size());
        b.setDs(null);

        pm = getPM();
        startTx(pm);
        b = (AttachB) pm.merge(b);
        assertNull(b.getDs());
        endTx(pm);
        endEm(pm);

        pm = getPM();
View Full Code Here

        d.setDint(12);
        b.getDs().add(d);

        pm = getPM();
        startTx(pm);
        b = (AttachB) pm.merge(b);
        assertSize(remove ? 1 : 2, b.getDs());
        endTx(pm);
        endEm(pm);

        pm = getPM();
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.