Package org.apache.openjpa.persistence

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


            java.util.List<NonstandardMappingEntity4> list = query.getResultList();
            for (NonstandardMappingEntity4 pc1 : list) {
                assertEquals(1.0, pc1.getPoint().getX());
                assertEquals(2.0, pc1.getPoint().getY());
            }
            em.clear();
        }
       
        em.close();
    }
}
View Full Code Here


            em1.clear();
            ListenerInEntity fo1 = em1.find(ListenerInEntity.class, id1);
            assertNotNull(fo1);
            assertListenerInEntityStatus(fo1, 0, 0, 0, 0, 0, 0, 1);

            em2.clear();
            ListenerInEntity fo2 = em2.find(ListenerInEntity.class, id2);
            assertNotNull(fo2);
            assertListenerInEntityStatus(fo1, 0, 0, 0, 0, 0, 0, 1);
            assertListenerInEntityStatus(fo2, 0, 0, 0, 0, 0, 0, 1);
View Full Code Here

            AddListenerEntity fo1 = em1.find(AddListenerEntity.class, id1);
            assertAddListenerEntityStatus(l1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);
            assertAddListenerEntityStatus(l2, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0);
            assertNotNull(fo1);

            em2.clear();
            AddListenerEntity fo2 = em2.find(AddListenerEntity.class, id2);
            assertAddListenerEntityStatus(l1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);
            assertAddListenerEntityStatus(l2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0);
            assertNotNull(fo2);
View Full Code Here

        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

        for (int i = 0; i < rs2.size(); i++) {
            Employee e = (Employee) rs2.get(i);
            assertFalse(e.getDepartment().getName().equals("Sales"));
        }

        em.clear();
        String jpql3 = "select e from Employee e where e.department in (:p1, :p2, :p3)";
        Query query = em.createQuery(jpql3);
        query.setParameter("p1", param1.get(0));
        query.setParameter("p2", param1.get(1));
        query.setParameter("p3", param1.get(2));
View Full Code Here

        for (int i = 0; i < rs3.size(); i++) {
            Employee e = (Employee) rs3.get(i);
            assertTrue(e.getDepartment().getName().equals("Marketing"));
        }

        em.clear();
        query = em.createQuery(jpql3);
        query.setParameter("p1", param2.get(0));
        query.setParameter("p2", param2.get(1));
        query.setParameter("p3", param2.get(2));
        List<Employee> rs4 = query.getResultList();
View Full Code Here

        for (int i = 0; i < rs4.size(); i++) {
            Employee e = (Employee) rs4.get(i);
            assertTrue(e.getDepartment().getName().equals("Engineering"));
        }

        em.clear();
        String jpql4 = "select p from Parent p where p.id < 3";
        String jpql5 = "select p from Parent p where p.id > 4";
        List<Parent> parm1 = em.createQuery(jpql4).getResultList();
        List<Parent> parm2 = em.createQuery(jpql5).getResultList();
       
View Full Code Here

        List<Parent> parm2 = em.createQuery(jpql5).getResultList();
       
        assertTrue("Size of two result list " + parm1.size() + " and " + parm2.size() +
            " must not be same", parm1.size() != parm2.size());
       
        em.clear();
        String jpql6 = "select c from Child c where c.parent in ?1";
        Query qry = em.createQuery(jpql6);
        qry.setParameter(1, parm1);
        List<Child> c1 = qry.getResultList();
        for (int i = 0; i < c1.size(); i++) {
View Full Code Here

        for (int i = 0; i < c1.size(); i++) {
            Child child = (Child) c1.get(i);
            assertTrue(child.getParent().getId() < 3);
        }
       
        em.clear();
        qry = em.createQuery(jpql6);
        qry.setParameter(1, parm2);
        List<Child> c2 = qry.getResultList();
        for (int i = 0; i < c2.size(); i++) {
            Child child = (Child) c2.get(i);
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";
        List<Department> param1 =
            (List<Department>) em.createQuery(jpql1).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.