Package org.apache.openjpa.persistence.jdbc

Examples of org.apache.openjpa.persistence.jdbc.JDBCFetchPlan


            q.setParameter(colArray.get(i), valArray.get(i));
            qTotal.setParameter(colArray.get(i), valArray.get(i));
        }

        OpenJPAQuery kq = OpenJPAPersistence.cast(q);
        JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
        fetch.setFetchBatchSize(20);
        fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE);
        fetch.setFetchDirection(FetchDirection.FORWARD);
        fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST);
        List<?> resultList = q.getResultList();
        List<Object[]> objectArrList = (List<Object[]>) resultList;
        List<CoordinatorJobBean> coordBeansList = new ArrayList<CoordinatorJobBean>();

        for (Object[] arr : objectArrList) {
View Full Code Here


                        }
                    }
                }

                OpenJPAQuery kq = OpenJPAPersistence.cast(q);
                JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
                fetch.setFetchBatchSize(20);
                fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE);
                fetch.setFetchDirection(FetchDirection.FORWARD);
                fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST);
                List<?> resultList = q.getResultList();
                List<Object[]> objectArrList = (List<Object[]>) resultList;
                List<WorkflowJobBean> wfBeansList = new ArrayList<WorkflowJobBean>();

                for (Object[] arr : objectArrList) {
View Full Code Here

                }
            }
        }

        OpenJPAQuery kq = OpenJPAPersistence.cast(q);
        JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
        fetch.setFetchBatchSize(20);
        fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE);
        fetch.setFetchDirection(FetchDirection.FORWARD);
        fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST);
        List<?> resultList = q.getResultList();
        List<Object[]> objectArrList = (List<Object[]>) resultList;
        List<WorkflowJobBean> wfBeansList = new ArrayList<WorkflowJobBean>();

        for (Object[] arr : objectArrList) {
View Full Code Here

            q.setParameter(colArray.get(i), valArray.get(i));
            qTotal.setParameter(colArray.get(i), valArray.get(i));
        }

        OpenJPAQuery kq = OpenJPAPersistence.cast(q);
        JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
        fetch.setFetchBatchSize(20);
        fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE);
        fetch.setFetchDirection(FetchDirection.FORWARD);
        fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST);
        List<?> resultList = q.getResultList();
        List<Object[]> objectArrList = (List<Object[]>) resultList;
        List<BundleJobBean> bundleBeansList = new ArrayList<BundleJobBean>();

        for (Object[] arr : objectArrList) {
View Full Code Here

            q.setParameter(colArray.get(i), valArray.get(i));
            qTotal.setParameter(colArray.get(i), valArray.get(i));
        }

        OpenJPAQuery kq = OpenJPAPersistence.cast(q);
        JDBCFetchPlan fetch = (JDBCFetchPlan) kq.getFetchPlan();
        fetch.setFetchBatchSize(20);
        fetch.setResultSetType(ResultSetType.SCROLL_INSENSITIVE);
        fetch.setFetchDirection(FetchDirection.FORWARD);
        fetch.setLRSSizeAlgorithm(LRSSizeAlgorithm.LAST);
        List<?> resultList = q.getResultList();
        List<Object[]> objectArrList = (List<Object[]>) resultList;
        List<CoordinatorJobBean> coordBeansList = new ArrayList<CoordinatorJobBean>();

        for (Object[] arr : objectArrList) {
View Full Code Here

    public void testFetchBatchSizeHint() {
        String hintName = "openjpa.FetchBatchSize";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();

        fetchBatchSizeHintTest(fPlan, fConfig, hintName, "-1", -1);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, -1, -1);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, "100", 100);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, 100, 100);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "xxxxx", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setFetchBatchSize(999);
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            assertEquals(fPlan.getFetchBatchSize(), -1);
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here

    public void testFetchPlanFetchBatchSizeHint() {
        String hintName = "openjpa.FetchPlan.FetchBatchSize";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();

        fetchBatchSizeHintTest(fPlan, fConfig, hintName, "0", 0);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, 0, 0);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, "500", 500);
        fetchBatchSizeHintTest(fPlan, fConfig, hintName, 500, 500);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setFetchBatchSize(999);
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            assertEquals(fPlan.getFetchBatchSize(), -1);
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here

    public void testFetchPlanEagerFetchModeHint() {
        String hintName = "openjpa.FetchPlan.EagerFetchMode";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();

        eagerFetchModeHintTest(fPlan, fConfig, hintName, "none",
            FetchMode.NONE, EagerFetchModes.EAGER_NONE);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.NONE.name(),
            FetchMode.NONE, EagerFetchModes.EAGER_NONE);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.NONE,
            FetchMode.NONE, EagerFetchModes.EAGER_NONE);

        eagerFetchModeHintTest(fPlan, fConfig, hintName, "parallel",
            FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.PARALLEL
            .name(), FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.PARALLEL,
            FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);

        eagerFetchModeHintTest(fPlan, fConfig, hintName, "join",
            FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.JOIN.name(),
            FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.JOIN,
            FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, "12345", false);
            fPlan.setHint(hintName, "67890", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -2, false);
            fPlan.setHint(hintName, -3, true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
View Full Code Here

    public void testJdbcEagerFetchModeHint() {
        String hintName = "openjpa.jdbc.EagerFetchMode";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();

        eagerFetchModeHintTest(fPlan, fConfig, hintName, String
            .valueOf(EagerFetchModes.EAGER_NONE), FetchMode.NONE,
            EagerFetchModes.EAGER_NONE);
        eagerFetchModeHintTest(fPlan, fConfig, hintName,
            EagerFetchModes.EAGER_NONE, FetchMode.NONE,
            EagerFetchModes.EAGER_NONE);

        eagerFetchModeHintTest(fPlan, fConfig, hintName,
            EagerFetchModes.EAGER_PARALLEL, FetchMode.PARALLEL,
            EagerFetchModes.EAGER_PARALLEL);
        eagerFetchModeHintTest(fPlan, fConfig, hintName, String
            .valueOf(EagerFetchModes.EAGER_PARALLEL), FetchMode.PARALLEL,
            EagerFetchModes.EAGER_PARALLEL);

        eagerFetchModeHintTest(fPlan, fConfig, hintName, String
            .valueOf(EagerFetchModes.EAGER_JOIN), FetchMode.JOIN,
            EagerFetchModes.EAGER_JOIN);
        eagerFetchModeHintTest(fPlan, fConfig, hintName,
            EagerFetchModes.EAGER_JOIN, FetchMode.JOIN,
            EagerFetchModes.EAGER_JOIN);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, "12345", false);
            fPlan.setHint(hintName, "67890", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -1, false);
            fPlan.setHint(hintName, -2, true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            assertEquals(fPlan.getEagerFetchMode(), FetchMode.PARALLEL);
        } catch (Exception e) {
              fail("Unexpected " + e.getClass().getName());
        }

        em.close();
View Full Code Here

    public void testFetchPlanJoinSyntaxHint() {
        String hintName = "openjpa.FetchPlan.JoinSyntax";

        EntityManager em = emf.createEntityManager();
        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();

        joinSyntaxHintTest(fPlan, fConfig, hintName, "sql92",
            JoinSyntax.SQL92, JoinSyntaxes.SYNTAX_SQL92);
        joinSyntaxHintTest(fPlan, fConfig, hintName, JoinSyntax.SQL92.name(),
            JoinSyntax.SQL92, JoinSyntaxes.SYNTAX_SQL92);
        joinSyntaxHintTest(fPlan, fConfig, hintName, JoinSyntax.SQL92,
            JoinSyntax.SQL92, JoinSyntaxes.SYNTAX_SQL92);

        joinSyntaxHintTest(fPlan, fConfig, hintName, "traditional",
            JoinSyntax.TRADITIONAL, JoinSyntaxes.SYNTAX_TRADITIONAL);
        joinSyntaxHintTest(fPlan, fConfig, hintName, JoinSyntax.TRADITIONAL
            .name(), JoinSyntax.TRADITIONAL, JoinSyntaxes.SYNTAX_TRADITIONAL);
        joinSyntaxHintTest(fPlan, fConfig, hintName, JoinSyntax.TRADITIONAL,
            JoinSyntax.TRADITIONAL, JoinSyntaxes.SYNTAX_TRADITIONAL);

        joinSyntaxHintTest(fPlan, fConfig, hintName, "database",
            JoinSyntax.DATABASE, JoinSyntaxes.SYNTAX_DATABASE);
        joinSyntaxHintTest(fPlan, fConfig, hintName,
            JoinSyntax.DATABASE.name(), JoinSyntax.DATABASE,
            JoinSyntaxes.SYNTAX_DATABASE);
        joinSyntaxHintTest(fPlan, fConfig, hintName, JoinSyntax.DATABASE,
            JoinSyntax.DATABASE, JoinSyntaxes.SYNTAX_DATABASE);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, "12345", false);
            fPlan.setHint(hintName, "67890", true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -1, false);
            fPlan.setHint(hintName, -2, true);
            fail("Expecting a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
View Full Code Here

TOP

Related Classes of org.apache.openjpa.persistence.jdbc.JDBCFetchPlan

Copyright © 2018 www.massapicom. 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.