Package org.apache.openjpa.persistence

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


        endEm(pm);

        pm = getPM();
        pm.setRetainState(true);
        startTx(pm);
        pc = (ModRuntimeTest1) pm.find(ModRuntimeTest1.class, oid);

        for (int i = 0; i < before; i++) {
            pc.setSelfOneOne(new ModRuntimeTest1("before" + i, i));
            pm.setSavepoint("before" + i);
        }
View Full Code Here


        }
        endTx(pm);
        endEm(pm);

        pm = getPM();
        pc = (ModRuntimeTest1) pm.find(ModRuntimeTest1.class, oid);
        assertEquals("orig", pc.getStringField());
        if (before > 0)
            assertEquals("before" + (before - 1),
                pc.getSelfOneOne().getStringField());
        else {
View Full Code Here

        endEm(pm);

        pm = getPM();
        pm.setRetainState(true);
        startTx(pm);
        pc = (ModRuntimeTest1) pm.find(ModRuntimeTest1.class, oid);

        for (int i = 0; i < before; i++) {
            pc.setSelfOneOne(new ModRuntimeTest1("before" + i, i));
            pm.setSavepoint("before" + i);
        }
View Full Code Here

            assertEquals("one", pc.getSelfOneOne().getStringField());
        endTx(pm);
        endEm(pm);

        pm = getPM();
        pc = (ModRuntimeTest1) pm.find(ModRuntimeTest1.class, oid);
        assertEquals("orig", pc.getStringField());
        if (before > 0)
            assertEquals("before" + (before - 1),
                pc.getSelfOneOne().getStringField());
        else
View Full Code Here

            endTx(pm);
            endEm(pm);

            pm = getPM();
            startTx(pm);
            pc = (ModRuntimeTest1) pm.find(ModRuntimeTest1.class, oid);
            assertEquals(2, pc.getSelfOneMany().size());
            for (Iterator it = pc.getSelfOneMany().iterator(); it.hasNext();) {
                temp = (ModRuntimeTest1) it.next();
                if (temp.getIntField() == 2)
                    pc2 = temp;
View Full Code Here

        assertEquals(2 + before, pc.getSelfOneMany().size());
        endTx(pm);
        endEm(pm);

        pm = getPM();
        pc = (ModRuntimeTest1) pm.find(ModRuntimeTest1.class, oid);
        assertEquals("orig", pc.getStringField());
        assertEquals(2 + before, pc.getSelfOneMany().size());
        boolean found2 = false;
        boolean found3 = false;
        for (Iterator it = pc.getSelfOneMany().iterator(); it.hasNext();) {
View Full Code Here

        endTx(pm);
        endEm(pm);

        pm = getPM();
        startTx(pm);
        pc = (RuntimeTest4) pm.find(RuntimeTest4.class, oid);
        assertEquals(12, pc.getRuntimeTest5s().size());
        int count = 0;
        for (Iterator i = pc.getRuntimeTest5s().iterator();
            count < 2; count++) {
            i.next();
View Full Code Here

        assertEquals(8, pc.getRuntimeTest5s().size());
        endTx(pm);
        endEm(pm);

        pm = getPM();
        pc = (RuntimeTest4) pm.find(RuntimeTest4.class, oid);
        assertEquals(8, pc.getRuntimeTest5s().size());
        endEm(pm);
    }

    private ModRuntimeTest1 newElement(ModRuntimeTest1 one, String str, int i) {
View Full Code Here

    public void testUpdate1() {
        OpenJPAEntityManager em =
            (OpenJPAEntityManager) currentEntityManager();
        startTx(em);

        RuntimeTest1 ret = em.find(RuntimeTest1.class, em.getObjectId(runt1));

        assertNotNull(ret);
        assertEquals("runt1", ret.getStringField());
        assertNotNull(ret.getSelfOneOne());
View Full Code Here

        assertEquals(1, updatedEntities);

        endTx(em);

        RuntimeTest1 ret2 = em.find(RuntimeTest1.class, em.getObjectId(runt1));
        em.refresh(ret2);

        assertNotNull(ret2);
        assertEquals("runner13", ret2.getStringField());
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.