Package org.apache.openjpa.persistence

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


        doCollectionTest(true);
    }

    private void doCollectionTest(boolean remove) {
        OpenJPAEntityManager pm = getPM();
        AttachB b = (AttachB) pm.find(AttachB.class, oid);

        assertNotNull("b is null in doCollectionTest", b);
        b.getDs();
        b = (AttachB) pm.detach(b);
        endEm(pm);
View Full Code Here


        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();
View Full Code Here

        endTx(pm);
        Object pcoid = pm.getObjectId(pc);
        endEm(pm);

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

        assertEquals(new Integer(100), pc.getStringIntMap().get("b"));
        endTx(pm);
        endEm(pm);

        pm = (OpenJPAEntityManager) factory.createEntityManager();
        pc = (DetachSMPC) pm.find(DetachSMPC.class, pcoid);
        assertEquals(3, pc.getIntField());
        assertSize(1, pc.getRelSet());
        assertEquals(4, ((DetachSMPC) pc.getRelSet().iterator().next())
            .getIntField());
        assertEquals(2, pc.getStringIntMap().size());
View Full Code Here

        endTx(pm);
        endEm(pm);

        pm = getPM();

        pc = (PCClassPC) pm.find(PCClassPC.class, oid);

        assertTrue(pc == pc.getSpecificPC());
        assertTrue(pc == pc.getGenericPC());
        assertNotNull(pc.getGenericObject());
        assertTrue(pc == pc.getGenericObject());
View Full Code Here

        // assumes false somewhere.
        pm.setIgnoreChanges(false);
        startTx(pm);
        try {
            RuntimeTest2 test2 =
                (RuntimeTest2) pm.find(RuntimeTest2.class, _oid2);
            pm.remove(test2);
            RuntimeTest1 test1 = new RuntimeTest1();
            pm.persist(test1);
            pm.remove(test1);
View Full Code Here

    }

    public void testDefaultLockGroupFailure1() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
View Full Code Here

        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setDefaultLockGroupStringField("pm2 value");

        endTx(pm1);
        endEm(pm1);
View Full Code Here

    }

    public void testDefaultLockGroupFailure2() {
        OpenJPAEntityManager pm1 = getPM(false, false);
        startTx(pm1);
        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
View Full Code Here

        LockGroupPC pc1 = (LockGroupPC) pm1.find(LockGroupPC.class, oid);
        pc1.setDefaultLockGroupStringField("pm1 value");

        OpenJPAEntityManager pm2 = getPM(false, false);
        startTx(pm2);
        LockGroupPC pc2 = (LockGroupPC) pm2.find(LockGroupPC.class, oid);
        pc2.setExplicitDefaultLockGroupIntField(2);

        endTx(pm1);
        endEm(pm1);
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.