Examples of createNativeQuery()


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

    }
   
    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

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

    }
   
    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);
        List res = (List) q.getResultList();
       
View Full Code Here

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

    }
   
    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

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

        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')",EagerPC.class);
View Full Code Here

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

        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

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

        pm.persist(pc);
        pm.commit();
        pm.close();
       
        pm = (OpenJPAEntityManager)currentEntityManager();;
        OpenJPAQuery q = pm.createNativeQuery("stringField == 'h2'",HelperPC.class);
        //FIXME jthomas
        //q.setUnique(true);
        HelperPC h2 = (HelperPC) q.getSingleResult();
       
        q = pm.createNativeQuery("helpers.containsKey ('h2')",pc.getClass());
View Full Code Here

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

        OpenJPAQuery q = pm.createNativeQuery("stringField == 'h2'",HelperPC.class);
        //FIXME jthomas
        //q.setUnique(true);
        HelperPC h2 = (HelperPC) q.getSingleResult();
       
        q = pm.createNativeQuery("helpers.containsKey ('h2')",pc.getClass());
        //FIXME jthomas
        //q.setUnique(true);
        pc = (MappedByMapPC) q.getSingleResult();
        assertEquals(3, pc.getHelpers().size());
        assertEquals(h2, pc.getHelpers().get("h2"));
View Full Code Here

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

        //q.setUnique(true);
        pc = (MappedByMapPC) q.getSingleResult();
        assertEquals(3, pc.getHelpers().size());
        assertEquals(h2, pc.getHelpers().get("h2"));
       
        q = pm.createNativeQuery("helpers.containsValue (:h2)",pc.getClass());
        //FIXME  jthomas
        //q.setUnique(true);
        pc = (MappedByMapPC) q.getSingleResult();
        assertEquals(3, pc.getHelpers().size());
        assertEquals(h2, pc.getHelpers().get("h2"));
View Full Code Here

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

            int e2Version = e2.getVersion();

            String e1Sql = "UPDATE CacheableEntity SET VERSN=?1 WHERE ID=?2";
            String e2Sql = "UPDATE XmlCacheableEntity SET VERSN=?1 WHERE ID=?2";
            em.getTransaction().begin();
            assertEquals(1, em.createNativeQuery(e1Sql).setParameter(1, e1Version + 1).setParameter(2, e1.getId())
                .executeUpdate());
            assertEquals(1, em.createNativeQuery(e2Sql).setParameter(1, e2Version + 1).setParameter(2, e2.getId())
                .executeUpdate());
            em.getTransaction().commit();
            em.refresh(e1);
View Full Code Here

Examples of org.hibernate.ogm.OgmSession.createNativeQuery()

  public void testUniqueResultQuery() throws Exception {
    OgmSession session = openSession();
    Transaction transaction = session.beginTransaction();

    String nativeQuery = "MATCH ( n:" + TABLE_NAME + " { name:'Portia', author:'Oscar Wilde' } ) RETURN n";
    OscarWildePoem poem = (OscarWildePoem) session.createNativeQuery( nativeQuery )
        .addEntity( OscarWildePoem.TABLE_NAME, OscarWildePoem.class )
        .uniqueResult();

    assertThat( poem ).isEqualTo( portia );
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.