Package org.apache.openjpa.persistence

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


            log.trace("IgnoreDetachedStateFieldForProxySerialization=" +
                compat.getIgnoreDetachedStateFieldForProxySerialization());
        }

        OpenJPAEntityManager em = emf2.createEntityManager();
        em.clear();

        ArrayList<Entity20> e20List = new ArrayList<Entity20>(numEntities);
        for (int i=0; i<numEntities; i++) {
            Entity20 e20 = em.find(Entity20.class, new Integer(i));
            e20List.add(e20);
View Full Code Here


            assertTrue(em.contains(e20));
            assertFalse(em.isDetached(e20));
            verifySerializable(e20, true, false);           
        }

        em.clear();

        for (int i=0; i<numEntities; i++) {
            if (log.isTraceEnabled())
                log.trace("** testClear20New() - after EM.clear() verify Entity20(" + i + ")");
            Entity20 e20 = e20List.get(i);
View Full Code Here

        item.setItemData(key);
        em.persist(item);
        em.flush();
        em.getTransaction().commit();
        int id = item.getItemId();
        em.clear();
        emf.getCache().evictAll();

        assertEquals(key, item.getItemData());

        em.setProperty(JPAProperties.CACHE_STORE_MODE, CacheStoreMode.USE);
View Full Code Here

       
        em.persist(mif);
        em.persist(ica);       
        em.getTransaction().commit();

        em.clear();

        // Verify that the iface table does not contain a discriminator column
        verifyNoDypeColumn(em, "ManagedIface");

        // Verify that the impl table does not contain a discriminator column
View Full Code Here

        em.persist(mif2);
        em.persist(scf)
        em.persist(bc3);
        em.getTransaction().commit();

        em.clear();

        // Verify that the iface table does not contain a discriminator column
        verifyNoDypeColumn(em, "ManagedIface2");

        // Verify that the subclass table does not contain a discriminator
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

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.