Package org.apache.openjpa.jdbc.kernel

Examples of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl


        String hintName = "openjpa.FetchPlan.LockTimeout";

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

        lockTimeoutHintTest(fPlan, fConfig, hintName, "-1", -1);
        lockTimeoutHintTest(fPlan, fConfig, hintName, -1, -1);
        lockTimeoutHintTest(fPlan, fConfig, hintName, "0", 0);
        lockTimeoutHintTest(fPlan, fConfig, hintName, 0, 0);
        lockTimeoutHintTest(fPlan, fConfig, hintName, "1500", 1500);
        lockTimeoutHintTest(fPlan, fConfig, hintName, 1500, 1500);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            int defTimeout = fConfig.getContext().getConfiguration()
                .getLockTimeout();
            assertEquals(defTimeout, fPlan.getLockTimeout());
            assertEquals(defTimeout, fConfig.getLockTimeout());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here


        String hintName = "javax.persistence.lock.timeout";

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

        lockTimeoutHintTest(fPlan, fConfig, hintName, "-1", -1);
        lockTimeoutHintTest(fPlan, fConfig, hintName, -1, -1);
        lockTimeoutHintTest(fPlan, fConfig, hintName, "0", 0);
        lockTimeoutHintTest(fPlan, fConfig, hintName, 0, 0);
        lockTimeoutHintTest(fPlan, fConfig, hintName, "2000", 2000);
        lockTimeoutHintTest(fPlan, fConfig, hintName, 2000, 2000);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            int defTimeout = fConfig.getContext().getConfiguration()
                .getLockTimeout();
            assertEquals(defTimeout, fPlan.getLockTimeout());
            assertEquals(defTimeout, fConfig.getLockTimeout());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here

        String hintName = "openjpa.QueryTimeout";

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

        queryTimeoutHintTest(fPlan, fConfig, hintName, "-1", -1);
        queryTimeoutHintTest(fPlan, fConfig, hintName, -1, -1);
        queryTimeoutHintTest(fPlan, fConfig, hintName, "0", 0);
        queryTimeoutHintTest(fPlan, fConfig, hintName, 0, 0);
        queryTimeoutHintTest(fPlan, fConfig, hintName, "100", 100);
        queryTimeoutHintTest(fPlan, fConfig, hintName, 100, 100);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            int defTimeout = fConfig.getContext().getConfiguration()
                .getQueryTimeout();
            assertEquals(defTimeout, fPlan.getQueryTimeout());
            assertEquals(defTimeout, fConfig.getQueryTimeout());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here

        String hintName = "openjpa.FetchPlan.QueryTimeout";

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

        queryTimeoutHintTest(fPlan, fConfig, hintName, "-1", -1);
        queryTimeoutHintTest(fPlan, fConfig, hintName, -1, -1);
        queryTimeoutHintTest(fPlan, fConfig, hintName, "0", 0);
        queryTimeoutHintTest(fPlan, fConfig, hintName, 0, 0);
        queryTimeoutHintTest(fPlan, fConfig, hintName, "1500", 1500);
        queryTimeoutHintTest(fPlan, fConfig, hintName, 1500, 1500);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            int defTimeout = fConfig.getContext().getConfiguration()
                .getQueryTimeout();
            assertEquals(defTimeout, fPlan.getQueryTimeout());
            assertEquals(defTimeout, fConfig.getQueryTimeout());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here

        String hintName = "javax.persistence.query.timeout";

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

        queryTimeoutHintTest(fPlan, fConfig, hintName, "-1", -1);
        queryTimeoutHintTest(fPlan, fConfig, hintName, -1, -1);
        queryTimeoutHintTest(fPlan, fConfig, hintName, "0", 0);
        queryTimeoutHintTest(fPlan, fConfig, hintName, 0, 0);
        queryTimeoutHintTest(fPlan, fConfig, hintName, "2000", 2000);
        queryTimeoutHintTest(fPlan, fConfig, hintName, 2000, 2000);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            int defTimeout = fConfig.getContext().getConfiguration()
                .getQueryTimeout();
            assertEquals(defTimeout, fPlan.getQueryTimeout());
            assertEquals(defTimeout, fConfig.getQueryTimeout());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
    }
View Full Code Here

        String hintName = "openjpa.FetchPlan.ResultSetType";

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

        resultSetTypeHintTest(fPlan, fConfig, hintName,
            ResultSetType.FORWARD_ONLY.name(), ResultSetType.FORWARD_ONLY,
            ResultSet.TYPE_FORWARD_ONLY);
View Full Code Here

        String hintName = "openjpa.jdbc.ResultSetType";

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

        resultSetTypeHintTest(fPlan, fConfig, hintName, String
            .valueOf(ResultSet.TYPE_FORWARD_ONLY), ResultSetType.FORWARD_ONLY,
            ResultSet.TYPE_FORWARD_ONLY);
        resultSetTypeHintTest(fPlan, fConfig, hintName,
            ResultSet.TYPE_FORWARD_ONLY, ResultSetType.FORWARD_ONLY,
            ResultSet.TYPE_FORWARD_ONLY);

        resultSetTypeHintTest(fPlan, fConfig, hintName, String
            .valueOf(ResultSet.TYPE_SCROLL_SENSITIVE),
            ResultSetType.SCROLL_SENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE);
        resultSetTypeHintTest(fPlan, fConfig, hintName,
            ResultSet.TYPE_SCROLL_SENSITIVE, ResultSetType.SCROLL_SENSITIVE,
            ResultSet.TYPE_SCROLL_SENSITIVE);

        resultSetTypeHintTest(fPlan, fConfig, hintName, String
            .valueOf(ResultSet.TYPE_SCROLL_INSENSITIVE),
            ResultSetType.SCROLL_INSENSITIVE,
            ResultSet.TYPE_SCROLL_INSENSITIVE);
        resultSetTypeHintTest(fPlan, fConfig, hintName,
            ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSetType.SCROLL_INSENSITIVE,
            ResultSet.TYPE_SCROLL_INSENSITIVE);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            assertEquals(ResultSet.TYPE_FORWARD_ONLY, fConfig
                .getResultSetType());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
View Full Code Here

        String hintName = "openjpa.FetchPlan.SubclassFetchMode";

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

        subclassFetchModeHintTest(fPlan, fConfig, hintName, "none",
            FetchMode.NONE, EagerFetchModes.EAGER_NONE);
        subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.NONE
View Full Code Here

        String hintName = "openjpa.jdbc.SubclassFetchMode";

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

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

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

        subclassFetchModeHintTest(fPlan, fConfig, hintName, String
            .valueOf(EagerFetchModes.EAGER_JOIN), FetchMode.JOIN,
            EagerFetchModes.EAGER_JOIN);
        subclassFetchModeHintTest(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 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 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            assertEquals(EagerFetchModes.EAGER_JOIN, fConfig
                .getSubclassFetchMode());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
View Full Code Here

        String hintName = "openjpa.FlushBeforeQueries";

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

        flushBeforeQueriesHintTest(fPlan, fConfig, hintName, String
            .valueOf(QueryFlushModes.FLUSH_TRUE), QueryFlushModes.FLUSH_TRUE);
        flushBeforeQueriesHintTest(fPlan, fConfig, hintName,
            QueryFlushModes.FLUSH_TRUE, QueryFlushModes.FLUSH_TRUE);

        flushBeforeQueriesHintTest(fPlan, fConfig, hintName, String
            .valueOf(QueryFlushModes.FLUSH_FALSE), QueryFlushModes.FLUSH_FALSE);
        flushBeforeQueriesHintTest(fPlan, fConfig, hintName,
            QueryFlushModes.FLUSH_FALSE, QueryFlushModes.FLUSH_FALSE);

        flushBeforeQueriesHintTest(fPlan, fConfig, hintName, String
            .valueOf(QueryFlushModes.FLUSH_WITH_CONNECTION),
            QueryFlushModes.FLUSH_WITH_CONNECTION);
        flushBeforeQueriesHintTest(fPlan, fConfig, hintName,
            QueryFlushModes.FLUSH_WITH_CONNECTION,
            QueryFlushModes.FLUSH_WITH_CONNECTION);

        try {
            fPlan.setHint(hintName, "xxxxx", false);
            fPlan.setHint(hintName, "yyyyy", true);
            fail("Expecting a 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 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 a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
            fConfig.getFlushBeforeQueries();
            assertEquals(QueryFlushModes.FLUSH_TRUE, fConfig
                .getFlushBeforeQueries());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.close();
View Full Code Here

TOP

Related Classes of org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl

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.