Examples of JDBCFetchConfigurationImpl


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

        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");
            fPlan.setHint(hintName, "yyyyy");
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -2);
            fPlan.setHint(hintName, -3);
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
            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

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

        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");
            fPlan.setHint(hintName, "yyyyy");
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -2);
            fPlan.setHint(hintName, -3);
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
            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

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

        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

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

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

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

        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

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

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

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

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

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

        String hintName = "openjpa.ReadLockLevel";

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

        readLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_NONE), LockModeType.NONE,
            MixedLockLevels.LOCK_NONE);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_NONE, LockModeType.NONE,
            MixedLockLevels.LOCK_NONE);

        readLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_READ), LockModeType.READ,
            MixedLockLevels.LOCK_READ);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_READ, LockModeType.READ,
            MixedLockLevels.LOCK_READ);

        readLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_WRITE), LockModeType.WRITE,
            MixedLockLevels.LOCK_WRITE);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_WRITE, LockModeType.WRITE,
            MixedLockLevels.LOCK_WRITE);

        readLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_OPTIMISTIC), LockModeType.OPTIMISTIC,
            MixedLockLevels.LOCK_OPTIMISTIC);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_OPTIMISTIC, LockModeType.OPTIMISTIC,
            MixedLockLevels.LOCK_OPTIMISTIC);

        readLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT),
            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT,
            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT);

        readLockLevelHintTest(fPlan, fConfig, hintName,
            String.valueOf(MixedLockLevels.LOCK_PESSIMISTIC_READ),
            LockModeType.PESSIMISTIC_READ,
            MixedLockLevels.LOCK_PESSIMISTIC_READ);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_PESSIMISTIC_READ,
            LockModeType.PESSIMISTIC_READ,
            MixedLockLevels.LOCK_PESSIMISTIC_READ);

        readLockLevelHintTest(fPlan, fConfig, hintName,
            String.valueOf(MixedLockLevels.LOCK_PESSIMISTIC_WRITE),
            LockModeType.PESSIMISTIC_WRITE,
            MixedLockLevels.LOCK_PESSIMISTIC_WRITE);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_PESSIMISTIC_WRITE,
            LockModeType.PESSIMISTIC_WRITE,
            MixedLockLevels.LOCK_PESSIMISTIC_WRITE);

        readLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT),
            LockModeType.PESSIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);
        readLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT,
            LockModeType.PESSIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);

        try {
            fPlan.setHint(hintName, "xxxxx");
            fPlan.setHint(hintName, "yyyyy");
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, "12345");
            fPlan.setHint(hintName, "67890");
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -1);
            fPlan.setHint(hintName, -2);
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
            assertEquals(MixedLockLevels.LOCK_READ, fConfig.getReadLockLevel());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.getTransaction().rollback();
        em.close();
View Full Code Here

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

        String hintName = "openjpa.WriteLockLevel";

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

        writeLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_NONE), LockModeType.NONE,
            MixedLockLevels.LOCK_NONE);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_NONE, LockModeType.NONE,
            MixedLockLevels.LOCK_NONE);

        writeLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_READ), LockModeType.READ,
            MixedLockLevels.LOCK_READ);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_READ, LockModeType.READ,
            MixedLockLevels.LOCK_READ);

        writeLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_WRITE), LockModeType.WRITE,
            MixedLockLevels.LOCK_WRITE);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_WRITE, LockModeType.WRITE,
            MixedLockLevels.LOCK_WRITE);

        writeLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_OPTIMISTIC), LockModeType.OPTIMISTIC,
            MixedLockLevels.LOCK_OPTIMISTIC);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_OPTIMISTIC, LockModeType.OPTIMISTIC,
            MixedLockLevels.LOCK_OPTIMISTIC);

        writeLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT),
            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT,
            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT);

        writeLockLevelHintTest(fPlan, fConfig, hintName,
            String.valueOf(MixedLockLevels.LOCK_PESSIMISTIC_READ),
            LockModeType.PESSIMISTIC_READ,
            MixedLockLevels.LOCK_PESSIMISTIC_READ);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_PESSIMISTIC_READ,
            LockModeType.PESSIMISTIC_READ,
            MixedLockLevels.LOCK_PESSIMISTIC_READ);

        writeLockLevelHintTest(fPlan, fConfig, hintName,
            String.valueOf(MixedLockLevels.LOCK_PESSIMISTIC_WRITE),
            LockModeType.PESSIMISTIC_WRITE,
            MixedLockLevels.LOCK_PESSIMISTIC_WRITE);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_PESSIMISTIC_WRITE,
            LockModeType.PESSIMISTIC_WRITE,
            MixedLockLevels.LOCK_PESSIMISTIC_WRITE);

        writeLockLevelHintTest(fPlan, fConfig, hintName, String
            .valueOf(MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT),
            LockModeType.PESSIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);
        writeLockLevelHintTest(fPlan, fConfig, hintName,
            MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT,
            LockModeType.PESSIMISTIC_FORCE_INCREMENT,
            MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);

        try {
            fPlan.setHint(hintName, "xxxxx");
            fPlan.setHint(hintName, "yyyyy");
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, "12345");
            fPlan.setHint(hintName, "67890");
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, -1);
            fPlan.setHint(hintName, -2);
            fail("Expecting a a IllegalArgumentException.");
        } catch (Exception e) {
            assertTrue("Caught expected exception",
                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
        }
        try {
            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
            assertEquals(MixedLockLevels.LOCK_WRITE, fConfig
                .getWriteLockLevel());
        } catch (Exception e) {
            fail("Unexpected " + e.getClass().getName());
        }
        em.getTransaction().rollback();
View Full Code Here

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

        String hintName = "openjpa.FetchPlan.ReadLockMode";

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

        readLockModeHintTest(fPlan, fConfig, hintName, "none",
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.