Package org.apache.openjpa.persistence

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


        throws Exception {
        initializePagingPCs();

      EntityManager em =currentEntityManager();
        OpenJPAEntityManager kem = OpenJPAPersistence.cast (em);
        Extent extent = kem.createExtent(PagingPC.class, true);
        extent.getFetchPlan().setFetchBatchSize(3);    // 1 on page 2
        extent.getFetchPlan().addFetchGroup("rel");
        extent.getFetchPlan().addFetchGroup("rels");

        // we should get two selects: the initial select and the IN eager stmnt
View Full Code Here


        plan.addFetchGroup("employee.department");
        plan.addFetchGroup("department.company");
        plan.addFetchGroup("company.address");
        plan.addFetchGroup("address.country");

        Iterator employees = pm.createExtent(PCEmployee.class, true).iterator();
        while (employees.hasNext()) {
            PCEmployee emp = (PCEmployee) employees.next();

            PCDepartment dept = (PCDepartment) PCEmployee.reflect(emp,
                "department");
View Full Code Here

        pm.getFetchPlan().setMaxFetchDepth(-1);
        plan.addFetchGroup("employee.department");
        plan.addFetchGroup("department.company");
        plan.addFetchGroup("company.address");

        Iterator employees = pm.createExtent(PCEmployee.class, true).iterator();
        while (employees.hasNext()) {
            PCEmployee emp = (PCEmployee) employees.next();

            PCDepartment dept = (PCDepartment) PCEmployee.reflect(emp,
                "department");
View Full Code Here

       
        kem.close();
       
        kem = _pmf.createEntityManager();
        startTx(kem);
        Extent extent = (Extent) kem.createExtent(ByteArrayPKPC.class,false);
        kem.detachAll(extent.list());
        extent.closeAll();
       
        ByteArrayPKPC owner = new ByteArrayPKPC();
        kem.persist(owner);
View Full Code Here

                CacheObjectB.class, CacheObjectC.class, CacheObjectD.class,
                CacheObjectE.class, CacheObjectJ.class,
                AppIdCacheObject.class, };
            for (int i = 0; i < toDelete.length; i++) {
                startTx(em);
                Extent e = em.createExtent(toDelete[i], true);
                Iterator it = e.iterator();
                while (it.hasNext()) {
                    em.remove(it.next());
                }
                endTx(em);
View Full Code Here

        startTx(pm);
        pm.persist(owner);
        endTx(pm);
        Object oid = pm.getObjectId(owner);
        assertEquals(3,
            ((Extent) pm.createExtent(DependentFieldsPC.class, true))
                .list().size());
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        owner = (DependentFieldsPC) pm.find(DependentFieldsPC.class, oid);
View Full Code Here

            assertEquals(0, owner.getDependentMappedList().size());
        else
            assertEquals(0, owner.getDependentInverseKeyList().size());
        endTx(pm);
        assertEquals(1,
            ((Extent) pm.createExtent(DependentFieldsPC.class, true)).
                list().size());
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        owner = (DependentFieldsPC) pm.find(DependentFieldsPC.class, oid);
View Full Code Here

    public void testMixedExtent() {
        createMixed();

        OpenJPAEntityManager em = emf.createEntityManager();
        Extent e = em.createExtent(MixedInterface.class, true);
        Set seen = new HashSet();
        int size = 0;
        for (Iterator it = e.iterator(); it.hasNext();) {
            seen.add(it.next().getClass());
            size++;
View Full Code Here

            size++;
        }
        assertEquals(3, size);
        assertEquals(2, seen.size());

        e = em.createExtent(MixedInterface.class, false);
        seen = new HashSet();
        size = 0;
        for (Iterator it = e.iterator(); it.hasNext();) {
            seen.add(it.next().getClass());
            size++;
View Full Code Here

            assertEquals(0, owner.getDependentMappedList().size());
        else
            assertEquals(0, owner.getDependentInverseKeyList().size());
        endTx(pm);
        assertEquals(1,
            ((Extent) pm.createExtent(DependentFieldsPC.class, true)).
                list().size());
        endEm(pm);

        pm = (OpenJPAEntityManager) currentEntityManager();
        owner = (DependentFieldsPC) pm.find(DependentFieldsPC.class, oid);
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.