Package org.apache.openjpa.persistence

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


                    "and (o.CustomerId = :customerId) "
                    "and (o.WarehouseId = :warehouseId) "
                    "and (o.DistrictId = :districtId)";

        em.getTransaction().begin();
        TypedQuery<OrderJPA> q1 = em.createQuery(jpql, OrderJPA.class);
        q1.setParameter("customerId", 339)
          .setParameter("districtId", 3)
          .setParameter("warehouseId", 23);
                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
View Full Code Here


                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
        assertFalse(q1.getResultList().isEmpty());
       
       
        TypedQuery<OrderJPA> q2 = em.createQuery(jpql, OrderJPA.class);
        assertEquals(QueryLanguages.LANG_PREPARED_SQL, OpenJPAPersistence.cast(q2).getLanguage());
        q2.setParameter("customerId", 2967)
          .setParameter("districtId", 5)
          .setParameter("warehouseId", 22);
       
View Full Code Here

                        "and (o.CustomerId = :customerId) "
                        "and (o.DistrictId = :districtId) "
                        "and (o.WarehouseId = :warehouseId)";

        em.getTransaction().begin();
        TypedQuery<OrderJPA> q1 = em.createQuery(jpql, OrderJPA.class);
        q1.setParameter("customerId", 339)
          .setParameter("districtId", 3)
          .setParameter("warehouseId", 23);
                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
View Full Code Here

                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
        assertFalse(q1.getResultList().isEmpty());
       
       
        TypedQuery<OrderJPA> q2 = em.createQuery(jpql, OrderJPA.class);
        assertEquals(QueryLanguages.LANG_PREPARED_SQL, OpenJPAPersistence.cast(q2).getLanguage());
        q2.setParameter("customerId", 2967)
          .setParameter("districtId", 5)
          .setParameter("warehouseId", 22);
       
View Full Code Here

                        "and (o.CustomerId = :customerId) "
                        "and (o.DistrictId = :districtId) "
                        "and (o.WarehouseId = :warehouseId)";

        em.getTransaction().begin();
        TypedQuery<OrderJPA> q1 = em.createQuery(jpql, OrderJPA.class);
        q1.setParameter("customerId", 339)
          .setParameter("districtId", 3)
          .setParameter("warehouseId", 23);
                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
View Full Code Here

                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
        assertFalse(q1.getResultList().isEmpty());
       
       
        TypedQuery<OrderJPA> q2 = em.createQuery(jpql, OrderJPA.class);
        assertEquals(QueryLanguages.LANG_PREPARED_SQL, OpenJPAPersistence.cast(q2).getLanguage());
        q2.setParameter("customerId", 2967)
          .setParameter("districtId", 5)
          .setParameter("warehouseId", 22);
       
View Full Code Here

                             "and   (o1.WarehouseId = :warehouseId))) "
                        "and (o.CustomerId = :customerId) "
                        "and (o.WarehouseId = :warehouseId)";

        em.getTransaction().begin();
        TypedQuery<OrderJPA> q1 = em.createQuery(jpql, OrderJPA.class);
        q1.setParameter("customerId", 339)
          .setParameter("districtId", 3)
          .setParameter("warehouseId", 23);
                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
View Full Code Here

                 
        assertEquals(JPQLParser.LANG_JPQL, OpenJPAPersistence.cast(q1).getLanguage());
        assertFalse(q1.getResultList().isEmpty());
       
       
        TypedQuery<OrderJPA> q2 = em.createQuery(jpql, OrderJPA.class);
        assertEquals(QueryLanguages.LANG_PREPARED_SQL, OpenJPAPersistence.cast(q2).getLanguage());
        q2.setParameter("customerId", 2967)
          .setParameter("districtId", 5)
          .setParameter("warehouseId", 22);
       
View Full Code Here

    public void testCollectionValuedParameterOfEntities() {
        OpenJPAEntityManager em = emf.createEntityManager();
        String jpql1 = "select d from Department d where d.name in ('Marketing', 'Sales') order by d.name";
        String jpql2 = "select d from Department d where d.name in ('Engineering', 'Marketing') order by d.name";
       
        List<Department> param1 = (List<Department>) em.createQuery(jpql1).getResultList();
        List<Department> param2 = (List<Department>) em.createQuery(jpql2).getResultList();
        em.clear();
       
        String jpql = "select e from Employee e where e.department in :param";
       
View Full Code Here

        OpenJPAEntityManager em = emf.createEntityManager();
        String jpql1 = "select d from Department d where d.name in ('Marketing', 'Sales') order by d.name";
        String jpql2 = "select d from Department d where d.name in ('Engineering', 'Marketing') order by d.name";
       
        List<Department> param1 = (List<Department>) em.createQuery(jpql1).getResultList();
        List<Department> param2 = (List<Department>) em.createQuery(jpql2).getResultList();
        em.clear();
       
        String jpql = "select e from Employee e where e.department in :param";
       
        List<Employee> rs1 = em.createQuery(jpql).setParameter("param", param1).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.