Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.FetchPlan.addField()


       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "oneManyCollection");
        fetch.addField(EagerOuterJoinPC.class, "helper");
        fetch.addField(EagerOuterJoinPC2.class, "helper");
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC.class);
        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
        assertEquals(1, results.size());
View Full Code Here


    private void stringCollectionByIdTest(boolean empty) {
        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());
View Full Code Here

    private void stringCollectionByQueryTest(int empty) {
        insertStringCollection(empty);
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringCollection");
        fetch.setFetchBatchSize(-1);
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC.class);
       
        //FIXME jthomas
        //q.setOrdering("name ascending");
View Full Code Here

        Object oid = insertStringList();
        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));
View Full Code Here

    public void testStringListByQuery() {
        insertStringList();
       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringList");
        fetch.setFetchBatchSize(-1);
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC.class);
        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
View Full Code Here

    OpenJPAEntityManager em = emf.createEntityManager();
    FetchPlan fp = em.getFetchPlan();
    fp.setExtendedPathLookup(true);
    fp.clearFetchGroups();
    fp.clearFields();
    fp.addField(FetchA.class, "b");
    fp.addField(FetchB.class, "text");

    FetchA a = (FetchA) em.createQuery(JPQL).getSingleResult();
    em.close();
View Full Code Here

    FetchPlan fp = em.getFetchPlan();
    fp.setExtendedPathLookup(true);
    fp.clearFetchGroups();
    fp.clearFields();
    fp.addField(FetchA.class, "b");
    fp.addField(FetchB.class, "text");

    FetchA a = (FetchA) em.createQuery(JPQL).getSingleResult();
    em.close();

    FetchB  b = a.getB();
View Full Code Here

    OpenJPAEntityManager em = emf.createEntityManager();
    FetchPlan fp = em.getFetchPlan();
        fp.setExtendedPathLookup(true);
    fp.clearFetchGroups();
    fp.clearFields();
    fp.addField(FetchA.class, "b");
    fp.addField(FetchA.class, "text");

    FetchA a = (FetchA) em.createQuery(JPQL).getSingleResult();
    em.close();
View Full Code Here

    FetchPlan fp = em.getFetchPlan();
        fp.setExtendedPathLookup(true);
    fp.clearFetchGroups();
    fp.clearFields();
    fp.addField(FetchA.class, "b");
    fp.addField(FetchA.class, "text");

    FetchA a = (FetchA) em.createQuery(JPQL).getSingleResult();
    em.close();

    FetchB  b = a.getB();
View Full Code Here

    OpenJPAEntityManager em = emf.createEntityManager();
    FetchPlan fp = em.getFetchPlan();
        fp.setExtendedPathLookup(true);
    fp.clearFetchGroups();
    fp.clearFields();
    fp.addField(FetchA.class, "b");
    fp.addField(FetchBase.class, "text");

    FetchA a = (FetchA) em.createQuery(JPQL).getSingleResult();
    em.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.