Examples of AttachD


Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        AttachE e = new AttachE();
        e.setEstr("E");
        e.setEint(5);

        AttachD d = new AttachD();
        d.setDint(5);
        d.setEmbeddedE(e);
        b.getDs().add(d);

        pm.persist(d);

        oid = b.getId();
        doid = d.getId();
        endTx(pm);
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        endEm(pm);
    }

    public void testEmbedded() {
        OpenJPAEntityManager pm = getPM();
        AttachD d = pm.find(AttachD.class, doid);

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

        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detach(d);
        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);

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

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

        assertEquals("E12", d2.getEmbeddedE().getEstr());
        assertEquals(5, d2.getEmbeddedE().getEint());
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        endEm(pm);
    }

    public void testNullEmbedded() {
        OpenJPAEntityManager pm = getPM();
        AttachD d = (AttachD) pm.find(AttachD.class, doid);

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

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

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

        assertNotNull("d2 is null in testNullEmbedded", d2);
        // no null ind
        if (d2.getEmbeddedE() != null) {
            assertNull(d2.getEmbeddedE().getEstr());
            assertEquals(0, d2.getEmbeddedE().getEint());
        }
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        endEm(pm);
    }

    public void testNullEmbeddedRelated() {
        OpenJPAEntityManager pm = getPM();
        AttachD d = (AttachD) pm.find(AttachD.class, doid);

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

        d.getEmbeddedE().getEstr();
        d = (AttachD) pm.detach(d);
        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);
        endEm(pm);

        pm = getPM();
        d2 = (AttachD) pm.find(AttachD.class, doid);
        assertNull("d2.getEmbeddedE().getEstr() is not null",
            d2.getEmbeddedE().getEstr());
        assertEquals("d2.getEmbeddedE().getEint() is not 5", 5,
            d2.getEmbeddedE().getEint());
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

            for (Iterator it = b.getDs().iterator(); it.hasNext();) {
                it.next();
                it.remove();
            }
        }
        AttachD d = new AttachD();
        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();
        b = (AttachB) pm.find(AttachB.class, oid);
        assertSize(remove ? 1 : 2, b.getDs());
        boolean found1 = false;
        boolean found2 = false;
        for (Iterator it = b.getDs().iterator(); it.hasNext();) {
            d = (AttachD) it.next();
            switch (d.getDint()) {
                case 5:
                    if (found1)
                        fail("Refound.");
                    found1 = true;
                    break;
                case 12:
                    if (found2)
                        fail("Refound.");
                    found2 = true;
                    break;
                default:
                    fail("Unknown d:" + d.getDint());
            }
        }

        if (remove)
            assertFalse(found1);
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        AttachE e = new AttachE();
        e.setEstr("E");
        e.setEint(5);

        AttachD d = new AttachD();
        d.setDint(5);
        d.setEmbeddedE(e);
        b.getDs().add(d);

        pm.persist(d);

        oid = b.getId();
        doid = d.getId();
        endTx(pm);
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        endEm(pm);
    }

    public void testEmbedded() {
        OpenJPAEntityManager pm = getPM();
        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);
        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);

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

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

        assertEquals("E12", d2.getEmbeddedE().getEstr());
        assertEquals(5, d2.getEmbeddedE().getEint());
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        endEm(pm);
    }

    public void testNullEmbedded() {
        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);
        AttachD d2 = (AttachD) pm.merge(d);
        assertNull(d2.getEmbeddedE());
        endTx(pm);
        endEm(pm);

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

        assertNotNull("d2 is null in testNullEmbedded", d2);
        // no null ind
        if (d2.getEmbeddedE() != null) {
            assertNull(d2.getEmbeddedE().getEstr());
            assertEquals(0, d2.getEmbeddedE().getEint());
        }
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

        endEm(pm);
    }

    public void testNullEmbeddedRelated() {
        OpenJPAEntityManager pm = getPM();
        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);
        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);
        endEm(pm);

        pm = getPM();
        d2 = (AttachD) pm.find(AttachD.class, doid);
        assertNull("d2.getEmbeddedE().getEstr() is not null",
            d2.getEmbeddedE().getEstr());
        assertEquals("d2.getEmbeddedE().getEint() is not 5", 5,
            d2.getEmbeddedE().getEint());
        endEm(pm);
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.kernel.common.apps.AttachD

            for (Iterator it = b.getDs().iterator(); it.hasNext();) {
                it.next();
                it.remove();
            }
        }
        AttachD d = new AttachD();
        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();
        b = (AttachB) pm.find(AttachB.class, oid);
        assertSize(remove ? 1 : 2, b.getDs());
        boolean found1 = false;
        boolean found2 = false;
        for (Iterator it = b.getDs().iterator(); it.hasNext();) {
            d = (AttachD) it.next();
            switch (d.getDint()) {
                case 5:
                    if (found1)
                        fail("Refound.");
                    found1 = true;
                    break;
                case 12:
                    if (found2)
                        fail("Refound.");
                    found2 = true;
                    break;
                default:
                    fail("Unknown d:" + d.getDint());
            }
        }

        if (remove)
            assertFalse(found1);
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.