Examples of EagerOuterJoinPC


Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        assertTrue(!itr.hasNext());
        pm.close();
    }
   
    private Object insertEagers() {
        EagerOuterJoinPC pc1 = new EagerOuterJoinPC();
        pc1.setName("1");
        pc1.getStringCollection().add("1.1");
        pc1.getStringCollection().add("1.2");
       
        EagerOuterJoinPC2 ref1 = new EagerOuterJoinPC2();
        ref1.setName("r1");
        ref1.getStringCollection().add("r1.1");
        ref1.getStringCollection().add("r1.2");
       
        EagerOuterJoinPC2 ref2 = new EagerOuterJoinPC2();
        ref2.setName("r2");
        ref2.getStringCollection().add("r2.1");
        ref2.getStringCollection().add("r2.2");
       
        HelperPC hpc1 = new HelperPC();
        hpc1.setStringField("h1");
       
        HelperPC hpc2 = new HelperPC();
        hpc2.setStringField("h2");
       
        HelperPC hpc3 = new HelperPC();
        hpc3.setStringField("h3");
       
        pc1.getManyManyList().add(ref1);
        pc1.getOneManyCollection().add(ref1);
        ref1.setRef(pc1);
        pc1.getManyManyList().add(ref2);
        pc1.getOneManyCollection().add(ref2);
        ref2.setRef(pc1);
       
        ref1.setHelper(hpc1);
        ref2.setHelper(hpc2);
        pc1.setHelper(hpc3);
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        startTx(pm);;
        pm.persist(pc1);
        endTx(pm);;
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        Object oid = insertStringCollection((empty) ? 1 : 0);
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringCollection");
        EagerOuterJoinPC pc = (EagerOuterJoinPC) pm.getObjectId(oid);
        assertEquals("1", pc.getName());
        if (empty)
            assertEquals(pc.getStringCollection().toString(),
                    0, pc.getStringCollection().size());
        else {
            assertEquals(pc.getStringCollection().toString(),
                    2, pc.getStringCollection().size());
            assertTrue(pc.getStringCollection().contains("1.1"));
            assertTrue(pc.getStringCollection().contains("1.2"));
        }
        pm.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
       
        assertEquals(2, results.size());
        Iterator itr = results.iterator();
        EagerOuterJoinPC pc = (EagerOuterJoinPC) itr.next();
        assertEquals("1", pc.getName());
        if ((empty & 1) > 0)
            assertEquals(pc.getStringCollection().toString(),
                    0, pc.getStringCollection().size());
        else {
            assertEquals(pc.getStringCollection().toString(),
                    2, pc.getStringCollection().size());
            assertTrue(pc.getStringCollection().contains("1.1"));
            assertTrue(pc.getStringCollection().contains("1.2"));
        }
       
        pc = (EagerOuterJoinPC) itr.next();
        assertEquals("2", pc.getName());
        if ((empty & 2) > 0)
            assertEquals(pc.getStringCollection().toString(),
                    0, pc.getStringCollection().size());
        else {
            assertEquals(pc.getStringCollection().toString(),
                    2, pc.getStringCollection().size());
            assertTrue(pc.getStringCollection().contains("2.1"));
            assertTrue(pc.getStringCollection().contains("2.2"));
        }
        assertTrue(!itr.hasNext());
        pm.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        assertTrue(!itr.hasNext());
        pm.close();
    }
   
    private Object insertStringCollection(int empty) {
        EagerOuterJoinPC pc1 = new EagerOuterJoinPC();
        pc1.setName("1");
        if ((empty & 1) == 0) {
            pc1.getStringCollection().add("1.1");
            pc1.getStringCollection().add("1.2");
        }
       
        EagerOuterJoinPC pc2 = new EagerOuterJoinPC();
        pc2.setName("2");
        if ((empty & 2) == 0) {
            pc2.getStringCollection().add("2.1");
            pc2.getStringCollection().add("2.2");
        }
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
       
        startTx(pm);;
        pm.persist(pc1);
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
       
       
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringList");
        EagerOuterJoinPC pc = (EagerOuterJoinPC) pm.getObjectId(oid);
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getStringList().size());
        assertEquals("1.1", pc.getStringList().get(0));
        assertEquals("1.2", pc.getStringList().get(1));
        pm.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
       
        assertEquals(2, results.size());
        Iterator itr = results.iterator();
        EagerOuterJoinPC pc = (EagerOuterJoinPC) itr.next();
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getStringList().size());
        assertEquals("1.1", pc.getStringList().get(0));
        assertEquals("1.2", pc.getStringList().get(1));
        pc = (EagerOuterJoinPC) itr.next();
        assertEquals("2", pc.getName());
        assertEquals(2, pc.getStringList().size());
        assertEquals("2.1", pc.getStringList().get(0));
        assertEquals("2.2", pc.getStringList().get(1));
        assertTrue(!itr.hasNext());
        pm.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        Object oid = insertOneManyCollection((empty) ? 1 : 0);
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "oneManyCollection");
        EagerOuterJoinPC pc = (EagerOuterJoinPC) pm.getObjectId(oid);
        assertEquals("1", pc.getName());
        if (empty)
            assertEquals(0, pc.getOneManyCollection().size());
        else
            assertEquals(2, pc.getOneManyCollection().size());
        pm.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
       
        assertEquals(2, results.size());
        Iterator itr = results.iterator();
        EagerOuterJoinPC pc = (EagerOuterJoinPC) itr.next();
        assertEquals("1", pc.getName());
        if ((empty & 1) > 0)
            assertEquals(0, pc.getOneManyCollection().size());
        else
            assertEquals(2, pc.getOneManyCollection().size());
       
        pc = (EagerOuterJoinPC) itr.next();
        assertEquals("2", pc.getName());
        if ((empty & 2) > 0)
            assertEquals(0, pc.getOneManyCollection().size());
        else
            assertEquals(2, pc.getOneManyCollection().size());
       
        assertTrue(!itr.hasNext());
        pm.close();
    }
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        assertTrue(!itr.hasNext());
        pm.close();
    }
   
    private Object insertOneManyCollection(int empty) {
        EagerOuterJoinPC pc1 = new EagerOuterJoinPC();
        pc1.setName("1");
        EagerOuterJoinPC2 hpc;
        if ((empty & 1) == 0) {
            hpc = new EagerOuterJoinPC2();
            hpc.setName("1.1");
            hpc.setRef(pc1);
            pc1.getOneManyCollection().add(hpc);
            hpc = new EagerOuterJoinPC2();
            hpc.setName("1.2");
            hpc.setRef(pc1);
            pc1.getOneManyCollection().add(hpc);
        }
       
        EagerOuterJoinPC pc2 = new EagerOuterJoinPC();
        pc2.setName("2");
        if ((empty & 2) == 0) {
            hpc = new EagerOuterJoinPC2();
            hpc.setName("2.1");
            hpc.setRef(pc2);
            pc2.getOneManyCollection().add(hpc);
            hpc = new EagerOuterJoinPC2();
            hpc.setName("2.2");
            hpc.setRef(pc2);
            pc2.getOneManyCollection().add(hpc);
        }
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        startTx(pm);
        pm.persist(pc1);
View Full Code Here

Examples of org.apache.openjpa.persistence.jdbc.common.apps.EagerOuterJoinPC

        Object oid = insertManyManyCollection();
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "manyManyCollection");
        EagerOuterJoinPC pc = (EagerOuterJoinPC) pm.getObjectId(oid);
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getManyManyCollection().size());
        pm.close();
    }
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.