Examples of EagerOuterJoinPC


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

   
    private void insertManyStringList() {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        startTx(pm);;
        for (int i = 0; i < 10; i++) {
            EagerOuterJoinPC pc = new EagerOuterJoinPC();
            pc.setName(String.valueOf(i));
            pc.getStringList().add(i + ".1");
            pc.getStringList().add(i + ".2");
            pm.persist(pc);
        }
        endTx(pm);;
        pm.close();
    }
View Full Code Here

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

        assertEquals(new ArrayList(results).toString(), 2, results.size());
       
        Iterator itr = results.iterator();
        EagerOuterJoinPC2 ref = (EagerOuterJoinPC2) itr.next();
        assertEquals("r1", ref.getName());
        EagerOuterJoinPC pc = ref.getRef();
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getStringCollection().size());
        assertTrue(pc.getStringCollection().contains("1.1"));
        assertTrue(pc.getStringCollection().contains("1.2"));
       
        ref = (EagerOuterJoinPC2) itr.next();
        assertEquals("r2", ref.getName());
        assertTrue(pc == ref.getRef());
       
View Full Code Here

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

        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
        assertEquals(1, results.size());
       
        EagerOuterJoinPC pc = (EagerOuterJoinPC) results.iterator().next();
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getManyManyList().size());
        EagerOuterJoinPC2 ref = (EagerOuterJoinPC2)
        pc.getManyManyList().get(0);
        assertEquals("r1", ref.getName());
        assertEquals("h1", ref.getHelper().getStringField());
        ref = (EagerOuterJoinPC2) pc.getManyManyList().get(1);
        assertEquals("r2", ref.getName());
        assertEquals("h2", ref.getHelper().getStringField());
       
        pm.close();
    }
View Full Code Here

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

        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
        assertEquals(1, results.size());
       
        EagerOuterJoinPC pc = (EagerOuterJoinPC) results.iterator().next();
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getManyManyList().size());
        EagerOuterJoinPC2 ref = (EagerOuterJoinPC2)
        pc.getManyManyList().get(0);
        assertEquals("r1", ref.getName());
        assertEquals(2, ref.getStringCollection().size());
        assertTrue(ref.getStringCollection().contains("r1.1"));
        assertTrue(ref.getStringCollection().contains("r1.2"));
       
        ref = (EagerOuterJoinPC2) pc.getManyManyList().get(1);
        assertEquals("r2", ref.getName());
        assertEquals(2, ref.getStringCollection().size());
        assertTrue(ref.getStringCollection().contains("r2.1"));
        assertTrue(ref.getStringCollection().contains("r2.2"));
       
View Full Code Here

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

        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
        assertEquals(1, results.size());
       
        EagerOuterJoinPC pc = (EagerOuterJoinPC) results.iterator().next();
        assertEquals("1", pc.getName());
        assertEquals("h3", pc.getHelper().getStringField());
        assertEquals(2, pc.getOneManyCollection().size());
        Iterator itr = pc.getOneManyCollection().iterator();
        EagerOuterJoinPC2 ref = (EagerOuterJoinPC2) itr.next();
        if ("r1".equals(ref.getName())) {
            assertEquals("h1", ref.getHelper().getStringField());
            ref = (EagerOuterJoinPC2) itr.next();
            assertEquals("r2", ref.getName());
View Full Code Here

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
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.