Examples of EagerOuterJoinPC


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

       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringCollection");
        fetch.addField(EagerOuterJoinPC.class, "manyManyList");
        EagerOuterJoinPC pc = (EagerOuterJoinPC) pm.getObjectId(oid);
        assertEquals("1", pc.getName());
        assertEquals(2, pc.getStringCollection().size());
        assertTrue(pc.getStringCollection().contains("1.1"));
        assertTrue(pc.getStringCollection().contains("1.2"));
        assertEquals(2, pc.getManyManyList().size());
        EagerOuterJoinPC2 hpc = (EagerOuterJoinPC2)
        pc.getManyManyList().get(0);
        assertEquals("1.1", hpc.getName());
        hpc = (EagerOuterJoinPC2) pc.getManyManyList().get(1);
        assertEquals("1.2", hpc.getName());
        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.getStringCollection().size());
        assertTrue(pc.getStringCollection().contains("1.1"));
        assertTrue(pc.getStringCollection().contains("1.2"));
        assertEquals(2, pc.getManyManyList().size());
        EagerOuterJoinPC2 hpc = (EagerOuterJoinPC2)
        pc.getManyManyList().get(0);
        assertEquals("1.1", hpc.getName());
        hpc = (EagerOuterJoinPC2) pc.getManyManyList().get(1);
        assertEquals("1.2", hpc.getName());
       
        pc = (EagerOuterJoinPC) itr.next();
        assertEquals("2", pc.getName());
        assertEquals(2, pc.getStringCollection().size());
        assertTrue(pc.getStringCollection().contains("2.1"));
        assertTrue(pc.getStringCollection().contains("2.2"));
        assertEquals(2, pc.getManyManyList().size());
        hpc = (EagerOuterJoinPC2) pc.getManyManyList().get(0);
        assertEquals("2.1", hpc.getName());
        hpc = (EagerOuterJoinPC2) pc.getManyManyList().get(1);
        assertEquals("2.2", hpc.getName());
       
        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 insertTwoCollections() {
        EagerOuterJoinPC pc1 = new EagerOuterJoinPC();
        pc1.setName("1");
        pc1.getStringCollection().add("1.1");
        pc1.getStringCollection().add("1.2");
        EagerOuterJoinPC2 hpc = new EagerOuterJoinPC2();
        hpc.setName("1.1");
        pc1.getManyManyList().add(hpc);
        hpc = new EagerOuterJoinPC2();
        hpc.setName("1.2");
        pc1.getManyManyList().add(hpc);
       
        EagerOuterJoinPC pc2 = new EagerOuterJoinPC();
        pc2.setName("2");
        pc2.getStringCollection().add("2.1");
        pc2.getStringCollection().add("2.2");
        hpc = new EagerOuterJoinPC2();
        hpc.setName("2.1");
        pc2.getManyManyList().add(hpc);
        hpc = new EagerOuterJoinPC2();
        hpc.setName("2.2");
        pc2.getManyManyList().add(hpc);
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        startTx(pm);;
        pm.persist(pc1);
        pm.persist(pc2);
View Full Code Here

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

        //q.setOrdering("name ascending");
        List results = (List) q.getResultList();
        assertEquals(10, results.size());
       
        for (int i = 5; i < results.size(); i++) {
            EagerOuterJoinPC pc = (EagerOuterJoinPC) results.get(i);
            assertEquals(String.valueOf(i), pc.getName());
            assertEquals(2, pc.getStringList().size());
            assertEquals(i + ".1", pc.getStringList().get(0));
            assertEquals(i + ".2", pc.getStringList().get(1));
        }
        q.closeAll();
        pm.close();
    }
View Full Code Here

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

       
        List results = (List) q.getResultList();
        assertEquals(5, results.size());
       
        for (int i = 0; i < results.size(); i++) {
            EagerOuterJoinPC pc = (EagerOuterJoinPC) results.get(i);
            assertEquals(String.valueOf(i + 5), pc.getName());
            assertEquals(2, pc.getStringList().size());
            assertEquals((i + 5) + ".1", pc.getStringList().get(0));
            assertEquals((i + 5) + ".2", pc.getStringList().get(1));
        }
        q.closeAll();
        pm.close();
    }
View Full Code Here

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