Package org.apache.openjpa.persistence

Examples of org.apache.openjpa.persistence.OpenJPAEntityManager.createNativeQuery()


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


        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringCollection");
        fetch.addField(EagerOuterJoinPC.class, "manyManyList");
        fetch.setFetchBatchSize(-1);
       
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC.class);
        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
       
        assertEquals(2, results.size());
View Full Code Here

       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringList");
        fetch.setFetchBatchSize(3);
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC.class);
        //FIXME jthomas
        //q.setOrdering("name ascending");
        List results = (List) q.getResultList();
        assertEquals(10, results.size());
       
View Full Code Here

       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "stringList");
        fetch.setFetchBatchSize(3);
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC.class);
        //FIXME jthomas
        //q.setOrdering("name ascending");
        //q.setRange(5, 20);
       
        List results = (List) q.getResultList();
View Full Code Here

       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC2.class, "ref");
        fetch.addField(EagerOuterJoinPC.class, "stringCollection");
        OpenJPAQuery q = pm.createNativeQuery("",EagerOuterJoinPC2.class);
        //FIXME jthomas
        //q.setOrdering("name ascending");
        Collection results = (Collection) q.getResultList();
        assertEquals(new ArrayList(results).toString(), 2, results.size());
       
View Full Code Here

       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "manyManyList");
        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

       
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        FetchPlan fetch = (FetchPlan) pm.getFetchPlan();
        fetch.addField(EagerOuterJoinPC.class, "manyManyList");
        fetch.addField(EagerOuterJoinPC2.class, "stringCollection");
        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

        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

            assertEquals("PU provided query timeout", setTime.intValue(),
                conf.getQueryTimeout());
            // create EM and Query
            em = emf.createEntityManager();
            assertNotNull(em);
            OpenJPAQuery q = em.createNativeQuery(nativeUpdateStr);
            q.setParameter(1, new String("updated"));
            // verify no default javax.persistence.query.timeout is supplied
            Map<String, Object> hints = q.getHints();
            assertFalse(hints.containsKey("javax.persistence.query.timeout"));
            // verify internal config values were updated
View Full Code Here

        OpenJPAEntityManager readPM = getPM(true, false);
        startTx(readPM);

        assertSize(0, flushPM.createNativeQuery("stringField == '" + name + "'",
            ModRuntimeTest1.class));
        assertSize(0, readPM.createNativeQuery("stringField == '" + name + "'",
            ModRuntimeTest1.class));

        ModRuntimeTest1 a = new ModRuntimeTest1(name, randomInt().intValue());

        flushPM.persist(a);
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.