Package org.apache.openjpa.persistence

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


    }
   
    public void testLeafNoSubs2()
    throws Exception {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        Extent extent = pm.createExtent(BaseSub2.class, false);
        Iterator itr = extent.iterator();
        assertTrue(itr.hasNext());
        BaseSub2 pc = (BaseSub2) itr.next();
        assertEquals(3, pc.getBaseField());
        assertEquals(4, pc.getBaseSub2Field());
View Full Code Here


    }
   
    public void testLeafWithSubs2()
    throws Exception {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        Extent extent = pm.createExtent(BaseSub2.class, true);
        Iterator itr = extent.iterator();
        assertTrue(itr.hasNext());
        BaseSub2 pc = (BaseSub2) itr.next();
        assertEquals(3, pc.getBaseField());
        assertEquals(4, pc.getBaseSub2Field());
View Full Code Here

    }
   
    public void testMidNoSubs()
    throws Exception {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        Extent extent = pm.createExtent(BaseSub1.class, false);
        Iterator itr = extent.iterator();
        assertTrue(itr.hasNext());
        BaseSub1 pc = (BaseSub1) itr.next();
        assertEquals(2, pc.getBaseField());
        assertEquals(3, pc.getBaseSub1Field());
View Full Code Here

    }
   
    public void testMidWithSubs()
    throws Exception {
        OpenJPAEntityManager pm =(OpenJPAEntityManager)currentEntityManager();
        Extent extent = pm.createExtent(BaseSub1.class, true);
        Collection pcs = new TreeSet(((Extent) extent).list());
        assertEquals(2, pcs.size());
        Iterator itr = pcs.iterator();
        BaseSub1 pc = (BaseSub1) itr.next();
        assertEquals(2, pc.getBaseField());
View Full Code Here

        initializePagingPCs();

        EntityManager em= currentEntityManager();
        //EntityManager em =currentEntityManager();
        OpenJPAEntityManager kem = OpenJPAPersistence.cast (em);
        Extent extent = kem.createExtent(PagingPC.class, true);

        extent.getFetchPlan().setFetchBatchSize(0);
        extent.getFetchPlan().addFetchGroup("rel");

        // if we only access the rel field, we should only have used 1 select
View Full Code Here

        throws Exception {
        initializePagingPCs();

        EntityManager em =currentEntityManager();
        OpenJPAEntityManager kem = OpenJPAPersistence.cast (em);
        Extent extent = kem.createExtent(PagingPC.class, true);
        extent.getFetchPlan().setFetchBatchSize(0);
        extent.getFetchPlan().addFetchGroup("rel");
        extent.getFetchPlan().addFetchGroup("rels");

View Full Code Here

        throws Exception {
        initializePagingAppIdPCs();

        EntityManager em =currentEntityManager();
        OpenJPAEntityManager kem = OpenJPAPersistence.cast (em);
        Extent extent = kem.createExtent(PagingAppIdPC.class, true);

        extent.getFetchPlan().setFetchBatchSize(0);
        extent.getFetchPlan().addFetchGroup("rel");
        extent.getFetchPlan().addFetchGroup("rels");
View Full Code Here

        throws Exception {
        initializePagingPCs();

        EntityManager em =currentEntityManager();
        OpenJPAEntityManager kem = OpenJPAPersistence.cast(em);
        Extent extent = kem.createExtent(PagingPC.class, true);

        extent.getFetchPlan().setFetchBatchSize(2);    // 2 pages of 2
        extent.getFetchPlan().addFetchGroup("rel");
        extent.getFetchPlan().addFetchGroup("rels");
View Full Code Here

        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

    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

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.