Package org.apache.openjpa.persistence

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


       
        // Select root (state 1)
        Query query = em.createQuery("select s from State s where s.name=:name");
        FetchPlan fetch = OpenJPAPersistence.cast(query).getFetchPlan();
        fetch.setMaxFetchDepth(15);
        fetch.addField(State.class, "incomingTransitions");
        fetch.addField(State.class, "outgoingTransitions");
        fetch.addField(Transition.class, "toState");
        fetch.addField(Transition.class, "fromState");
        State qs1 = (State) query.setParameter("name", "s1").getSingleResult();
View Full Code Here


        // Select root (state 1)
        Query query = em.createQuery("select s from State s where s.name=:name");
        FetchPlan fetch = OpenJPAPersistence.cast(query).getFetchPlan();
        fetch.setMaxFetchDepth(15);
        fetch.addField(State.class, "incomingTransitions");
        fetch.addField(State.class, "outgoingTransitions");
        fetch.addField(Transition.class, "toState");
        fetch.addField(Transition.class, "fromState");
        State qs1 = (State) query.setParameter("name", "s1").getSingleResult();

        em.close(); // will not load anything anymore
View Full Code Here

        Query query = em.createQuery("select s from State s where s.name=:name");
        FetchPlan fetch = OpenJPAPersistence.cast(query).getFetchPlan();
        fetch.setMaxFetchDepth(15);
        fetch.addField(State.class, "incomingTransitions");
        fetch.addField(State.class, "outgoingTransitions");
        fetch.addField(Transition.class, "toState");
        fetch.addField(Transition.class, "fromState");
        State qs1 = (State) query.setParameter("name", "s1").getSingleResult();

        em.close(); // will not load anything anymore
View Full Code Here

        FetchPlan fetch = OpenJPAPersistence.cast(query).getFetchPlan();
        fetch.setMaxFetchDepth(15);
        fetch.addField(State.class, "incomingTransitions");
        fetch.addField(State.class, "outgoingTransitions");
        fetch.addField(Transition.class, "toState");
        fetch.addField(Transition.class, "fromState");
        State qs1 = (State) query.setParameter("name", "s1").getSingleResult();

        em.close(); // will not load anything anymore

        byte[][] actualTransitionMatrix = new byte[5][5];
View Full Code Here

   
    Query query = em.createQuery("select o from Case as o" +
        " where o.scheduleDay = :sd");
    query.setParameter("sd", sd);
    FetchPlan fetchPlan = ((QueryImpl) query).getFetchPlan();
    fetchPlan.addField(Case.class, "scheduledAssignments");
   
    //Without the changes of OJ1424, this next call would cause an
    //ArrayIndexOutOfBoundsException.
    List<Case> allCases = query.getResultList();
  }
View Full Code Here

    OpenJPAEntityManager em = emf.createEntityManager();
    FetchPlan fp = em.getFetchPlan();
    fp.setExtendedPathLookup(true);
    fp.clearFetchGroups().removeFetchGroup(FetchGroup.NAME_DEFAULT);
    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().removeFetchGroup(FetchGroup.NAME_DEFAULT);
    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().removeFetchGroup(FetchGroup.NAME_DEFAULT);
    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().removeFetchGroup(FetchGroup.NAME_DEFAULT);
    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().removeFetchGroup(FetchGroup.NAME_DEFAULT);
    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.