Package org.apache.openjpa.persistence

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


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

        flushPM.persist(a);

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

        flushPM.flush();

        // make sure the other pm doesn't see the flushed object
View Full Code Here


            ModRuntimeTest1.class));

        flushPM.flush();

        // make sure the other pm doesn't see the flushed object
        assertSize(0, readPM.createNativeQuery("name == '" + name + "'",
            ModRuntimeTest1.class));

        flushPM.remove(a);

        assertSize(0, flushPM.createNativeQuery("name == '" + name + "'",
View Full Code Here

        flushPM.remove(a);

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

        endTx(flushPM);
        endEm(flushPM);
View Full Code Here

            // Following fails to cause a SQLException, but takes 2+ secs
            // Query q = em.createNativeQuery("INSERT INTO QTimeout (id, " +
            //    "stringField) VALUES (?,?)");
            // q.setParameter(1, 99);
            // q.setParameter(2, new String("inserted"));
            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"));
            // update the query timeout value and verify it was set
View Full Code Here

    }

    public void testProjections()
        throws Exception {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        OpenJPAQuery q = pm.createNativeQuery("",Relations.class);
        //FIXME jthomas
        /*
        q.setResult("base, baseSub1, baseSub1Sub2");
        q.setUnique(true);
        Object[] res = (Object[]) q.execute();
View Full Code Here

    }
   
    private void eagerParallelWithNonDistinctQuery(int fetchSize)
    throws Exception {
        OpenJPAEntityManager pm = getPM();
        OpenJPAQuery q = pm.createNativeQuery(
                "stringField.startsWith ('pc')", HelperPC2.class);
        //FIXME jthomas
        //q.setOrdering("stringField ascending");
        q.getFetchPlan().setFetchBatchSize(fetchSize);
        List res = (List) q.getResultList();
View Full Code Here

    }
   
    private void eagerParallelWithDistinctQuery(int fetchSize)
    throws Exception {
        OpenJPAEntityManager pm = getPM();
        OpenJPAQuery q = pm.createNativeQuery(
                "helperCollection.contains (h) && h.stringField == 'shared'",
                HelperPC2.class);
        //FIXME  jthomas
        //q.setOrdering("stringField ascending");
        q.getFetchPlan().setFetchBatchSize(fetchSize);
View Full Code Here

    }
   
    private void nestedEagerParallel(int fetchSize)
    throws Exception {
        OpenJPAEntityManager pm = getPM();
        OpenJPAQuery q = pm.createNativeQuery("",HelperPC2.class);
        //FIXME jthomas
        //q.setOrdering("stringField ascending");
        List helpers = (List) q.getResultList();
       
        EagerPC eager1 = new EagerPC();
View Full Code Here

        pm.persist(eager1);
        pm.persist(eager2);
        endTx(pm);;
        // make sure subclasses selected, etc
        //FIXME jthomas
        pm.createNativeQuery("",EagerPC.class).getResultList();
        pm.close();
        sql.clear();
       
        pm = getPM();
        q = pm.createNativeQuery("stringField.startsWith ('eager')",
View Full Code Here

        pm.createNativeQuery("",EagerPC.class).getResultList();
        pm.close();
        sql.clear();
       
        pm = getPM();
        q = pm.createNativeQuery("stringField.startsWith ('eager')",
                EagerPC.class);
        //FIXME jthomas
        //q.setOrdering("stringField ascending");
        q.getFetchPlan().setFetchBatchSize(fetchSize);
        List res = (List) q.getResultList();
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.