openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r762161 [3/7] - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/kernel/ openjpa-kernel/src/main/ja...
Date Sun, 05 Apr 2009 21:29:44 GMT
Added: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java?rev=762161&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java (added)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java Sun Apr  5 21:29:42 2009
@@ -0,0 +1,2464 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.persistence.lockmgr;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.util.HashMap;
+
+import javax.persistence.EntityManager;
+import javax.persistence.LockModeType;
+import javax.persistence.Query;
+
+import org.apache.openjpa.conf.OpenJPAConfiguration;
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
+import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
+import org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl;
+import org.apache.openjpa.jdbc.kernel.LRSSizes;
+import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
+import org.apache.openjpa.kernel.FetchConfiguration;
+import org.apache.openjpa.kernel.MixedLockLevels;
+import org.apache.openjpa.kernel.QueryFlushModes;
+import org.apache.openjpa.persistence.EntityManagerImpl;
+import org.apache.openjpa.persistence.OpenJPAEntityManager;
+import org.apache.openjpa.persistence.jdbc.FetchDirection;
+import org.apache.openjpa.persistence.jdbc.FetchMode;
+import org.apache.openjpa.persistence.jdbc.IsolationLevel;
+import org.apache.openjpa.persistence.jdbc.JDBCFetchPlan;
+import org.apache.openjpa.persistence.jdbc.JoinSyntax;
+import org.apache.openjpa.persistence.jdbc.LRSSizeAlgorithm;
+import org.apache.openjpa.persistence.jdbc.ResultSetType;
+
+/**
+ * Test FetchPlan and FetchConfiguration hints processing for use in
+ * JPA 2.0 em.find/refresh/lock(... Map) and query.X(... Map) methods.
+ *
+ * Supported hints:
+ *   javax.persistence.lock.timeout
+ *   javax.persistence.query.timeout
+ *   openjpa.ExtendedPathLookup (?)
+ *   openjpa.FetchBatchSize
+ *   openjpa.FetchPlan.EagerFetchMode
+ *   openjpa.FetchPlan.ExtendedPathLookup (?)
+ *   openjpa.FetchPlan.FetchBatchSize
+ *   openjpa.FetchPlan.FetchDirection
+ *   openjpa.FetchPlan.Isolation
+ *   openjpa.FetchPlan.JoinSyntax
+ *   openjpa.FetchPlan.LRSSize
+ *   openjpa.FetchPlan.LRSSizeAlgorithm
+ *   openjpa.FetchPlan.LockTimeout
+ *   openjpa.FetchPlan.MaxFetchDepth
+ *   openjpa.FetchPlan.QueryTimeout
+ *   openjpa.FetchPlan.ReadLockMode
+ *   openjpa.FetchPlan.ResultSetType
+ *   openjpa.FetchPlan.SubclassFetchMode
+ *   openjpa.FetchPlan.WriteLockMode
+ *   openjpa.FlushBeforeQueries
+ *   openjpa.LockTimeout
+ *   openjpa.MaxFetchDepth
+ *   openjpa.QueryCacheEnabled
+ *   openjpa.QueryTimeout
+ *   openjpa.ReadLockLevel
+ *   openjpa.WriteLockLevel
+ *   openjpa.jdbc.EagerFetchMode
+ *   openjpa.jdbc.FetchDirection
+ *   openjpa.jdbc.JoinSyntax
+ *   openjpa.jdbc.LRSSize
+ *   openjpa.jdbc.ResultSetType
+ *   openjpa.jdbc.SubclassFetchMode
+ *   openjpa.jdbc.TransactionIsolation
+ */
+public class TestFetchHints extends SequencedActionsTest {
+    public void setUp() {
+        setUp(LockEmployee.class
+            , "openjpa.LockManager", "mixed"
+            );
+        commonSetUp();
+    }
+
+    /* Good
+     * Test "openjpa.FetchBatchSize" hint
+     */
+    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();
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.FetchBatchSize" hint
+     */
+    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();
+    }
+
+    private void fetchBatchSizeHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        int expected) {
+        fConfig.setFetchBatchSize(999);
+        fPlan.setHint(hint, value, false);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expected, fPlan.getFetchBatchSize());
+        assertEquals(expected, fConfig.getFetchBatchSize());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.EagerFetchMode" hint
+     */
+    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()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.EagerFetchMode" hint
+     */
+    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();
+    }
+
+    private void eagerFetchModeHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getEagerFetchMode());
+        assertEquals(expected, fConfig.getEagerFetchMode());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.JoinSyntax" hint
+     */
+    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()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.JoinSyntax" hint
+     */
+    public void testJdbcJoinSyntaxHint() {
+        String hintName = "openjpa.jdbc.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, String
+            .valueOf(JoinSyntaxes.SYNTAX_SQL92), JoinSyntax.SQL92,
+            JoinSyntaxes.SYNTAX_SQL92);
+        joinSyntaxHintTest(fPlan, fConfig, hintName, JoinSyntaxes.SYNTAX_SQL92,
+            JoinSyntax.SQL92, JoinSyntaxes.SYNTAX_SQL92);
+
+        joinSyntaxHintTest(fPlan, fConfig, hintName, String
+            .valueOf(JoinSyntaxes.SYNTAX_TRADITIONAL), JoinSyntax.TRADITIONAL,
+            JoinSyntaxes.SYNTAX_TRADITIONAL);
+        joinSyntaxHintTest(fPlan, fConfig, hintName,
+            JoinSyntaxes.SYNTAX_TRADITIONAL, JoinSyntax.TRADITIONAL,
+            JoinSyntaxes.SYNTAX_TRADITIONAL);
+
+        joinSyntaxHintTest(fPlan, fConfig, hintName, String
+            .valueOf(JoinSyntaxes.SYNTAX_DATABASE), JoinSyntax.DATABASE,
+            JoinSyntaxes.SYNTAX_DATABASE);
+        joinSyntaxHintTest(fPlan, fConfig, hintName,
+            JoinSyntaxes.SYNTAX_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()));
+        }
+        try {
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
+            assertEquals(fConfig.getJoinSyntax(),
+                ((JDBCConfiguration) fConfig.getContext().getConfiguration())
+                    .getDBDictionaryInstance().joinSyntax);
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    private void joinSyntaxHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getJoinSyntax());
+        assertEquals(expected, fConfig.getJoinSyntax());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.FetchDirection" hint
+     */
+    public void testFetchPlanFetchDirectionHint() {
+        String hintName = "openjpa.FetchPlan.FetchDirection";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        fetchDirectionHintTest(fPlan, fConfig, hintName, "forward",
+            FetchDirection.FORWARD, ResultSet.FETCH_FORWARD);
+        fetchDirectionHintTest(fPlan, fConfig, hintName, FetchDirection.FORWARD
+            .name(), FetchDirection.FORWARD, ResultSet.FETCH_FORWARD);
+        fetchDirectionHintTest(fPlan, fConfig, hintName,
+            FetchDirection.FORWARD, FetchDirection.FORWARD,
+            ResultSet.FETCH_FORWARD);
+
+        fetchDirectionHintTest(fPlan, fConfig, hintName, "reverse",
+            FetchDirection.REVERSE, ResultSet.FETCH_REVERSE);
+        fetchDirectionHintTest(fPlan, fConfig, hintName, FetchDirection.REVERSE
+            .name(), FetchDirection.REVERSE, ResultSet.FETCH_REVERSE);
+        fetchDirectionHintTest(fPlan, fConfig, hintName,
+            FetchDirection.REVERSE, FetchDirection.REVERSE,
+            ResultSet.FETCH_REVERSE);
+
+        fetchDirectionHintTest(fPlan, fConfig, hintName, "unknown",
+            FetchDirection.UNKNOWN, ResultSet.FETCH_UNKNOWN);
+        fetchDirectionHintTest(fPlan, fConfig, hintName, FetchDirection.UNKNOWN
+            .name(), FetchDirection.UNKNOWN, ResultSet.FETCH_UNKNOWN);
+        fetchDirectionHintTest(fPlan, fConfig, hintName,
+            FetchDirection.UNKNOWN, FetchDirection.UNKNOWN,
+            ResultSet.FETCH_UNKNOWN);
+
+        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()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.FetchDirection" hint
+     */
+    public void testJdbcFetchDirectionHint() {
+        String hintName = "openjpa.jdbc.FetchDirection";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        fetchDirectionHintTest(fPlan, fConfig, hintName, String
+            .valueOf(ResultSet.FETCH_FORWARD), FetchDirection.FORWARD,
+            ResultSet.FETCH_FORWARD);
+        fetchDirectionHintTest(fPlan, fConfig, hintName,
+            ResultSet.FETCH_FORWARD, FetchDirection.FORWARD,
+            ResultSet.FETCH_FORWARD);
+
+        fetchDirectionHintTest(fPlan, fConfig, hintName, String
+            .valueOf(ResultSet.FETCH_REVERSE), FetchDirection.REVERSE,
+            ResultSet.FETCH_REVERSE);
+        fetchDirectionHintTest(fPlan, fConfig, hintName,
+            ResultSet.FETCH_REVERSE, FetchDirection.REVERSE,
+            ResultSet.FETCH_REVERSE);
+
+        fetchDirectionHintTest(fPlan, fConfig, hintName, String
+            .valueOf(ResultSet.FETCH_UNKNOWN), FetchDirection.UNKNOWN,
+            ResultSet.FETCH_UNKNOWN);
+        fetchDirectionHintTest(fPlan, fConfig, hintName,
+            ResultSet.FETCH_UNKNOWN, FetchDirection.UNKNOWN,
+            ResultSet.FETCH_UNKNOWN);
+
+        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(fConfig.getFetchDirection(), ResultSet.FETCH_FORWARD);
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    private void fetchDirectionHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getFetchDirection());
+        assertEquals(expected, fConfig.getFetchDirection());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.Isolation" hint
+     */
+    public void testFetchPlanIsolationHint() {
+        String hintName = "openjpa.FetchPlan.Isolation";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        isolationHintTest(oem, fPlan, fConfig, hintName, "default",
+            IsolationLevel.DEFAULT, -1);
+        isolationHintTest(oem, fPlan, fConfig, hintName, "DEFAULT",
+            IsolationLevel.DEFAULT, -1);
+        isolationHintTest(oem, fPlan, fConfig, hintName,
+            IsolationLevel.DEFAULT, IsolationLevel.DEFAULT, -1);
+
+        boolean supportIsolationForUpdate = ((JDBCConfiguration) fConfig
+            .getContext().getConfiguration()).getDBDictionaryInstance()
+            .supportsIsolationForUpdate();
+        if (supportIsolationForUpdate) {
+            isolationHintTest(oem, fPlan, fConfig, hintName, "none",
+                IsolationLevel.NONE, Connection.TRANSACTION_NONE);
+            isolationHintTest(oem, fPlan, fConfig, hintName, "NONE",
+                IsolationLevel.NONE, Connection.TRANSACTION_NONE);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                IsolationLevel.NONE, IsolationLevel.NONE,
+                Connection.TRANSACTION_NONE);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                "read-uncommitted", IsolationLevel.READ_UNCOMMITTED,
+                Connection.TRANSACTION_READ_UNCOMMITTED);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                "READ_UNCOMMITTED", IsolationLevel.READ_UNCOMMITTED,
+                Connection.TRANSACTION_READ_UNCOMMITTED);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                IsolationLevel.READ_UNCOMMITTED,
+                IsolationLevel.READ_UNCOMMITTED,
+                Connection.TRANSACTION_READ_UNCOMMITTED);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, "read-committed",
+                IsolationLevel.READ_COMMITTED,
+                Connection.TRANSACTION_READ_COMMITTED);
+            isolationHintTest(oem, fPlan, fConfig, hintName, "READ_COMMITTED",
+                IsolationLevel.READ_COMMITTED,
+                Connection.TRANSACTION_READ_COMMITTED);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                IsolationLevel.READ_COMMITTED, IsolationLevel.READ_COMMITTED,
+                Connection.TRANSACTION_READ_COMMITTED);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, "repeatable-read",
+                IsolationLevel.REPEATABLE_READ,
+                Connection.TRANSACTION_REPEATABLE_READ);
+            isolationHintTest(oem, fPlan, fConfig, hintName, "REPEATABLE_READ",
+                IsolationLevel.REPEATABLE_READ,
+                Connection.TRANSACTION_REPEATABLE_READ);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                IsolationLevel.REPEATABLE_READ, IsolationLevel.REPEATABLE_READ,
+                Connection.TRANSACTION_REPEATABLE_READ);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, "serializable",
+                IsolationLevel.SERIALIZABLE,
+                Connection.TRANSACTION_SERIALIZABLE);
+            isolationHintTest(oem, fPlan, fConfig, hintName, "SERIALIZABLE",
+                IsolationLevel.SERIALIZABLE,
+                Connection.TRANSACTION_SERIALIZABLE);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                IsolationLevel.SERIALIZABLE, IsolationLevel.SERIALIZABLE,
+                Connection.TRANSACTION_SERIALIZABLE);
+        }
+
+        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 a IllegalArgumentException.");
+        } catch (Exception e) {
+            assertTrue("Caught expected exception",
+                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
+        }
+        try {
+            fPlan.setHint(hintName, -1, false);
+            fPlan.setHint(hintName, -1, true);
+            fail("Expecting a a IllegalArgumentException.");
+        } catch (Exception e) {
+            assertTrue("Caught expected exception",
+                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.TransactionIsolation" hint
+     */
+    public void testJdbcTransactionIsolationHint() {
+        String hintName = "openjpa.jdbc.TransactionIsolation";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        isolationHintTest(oem, fPlan, fConfig, hintName, "-1",
+            IsolationLevel.DEFAULT, -1);
+        isolationHintTest(oem, fPlan, fConfig, hintName, -1,
+            IsolationLevel.DEFAULT, -1);
+
+        boolean supportIsolationForUpdate = ((JDBCConfiguration) fConfig
+            .getContext().getConfiguration()).getDBDictionaryInstance()
+            .supportsIsolationForUpdate();
+        if (supportIsolationForUpdate) {
+            isolationHintTest(oem, fPlan, fConfig, hintName, String
+                .valueOf(Connection.TRANSACTION_NONE), IsolationLevel.NONE,
+                Connection.TRANSACTION_NONE);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                Connection.TRANSACTION_NONE, IsolationLevel.NONE,
+                Connection.TRANSACTION_NONE);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, String
+                .valueOf(Connection.TRANSACTION_READ_UNCOMMITTED),
+                IsolationLevel.READ_UNCOMMITTED,
+                Connection.TRANSACTION_READ_UNCOMMITTED);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                Connection.TRANSACTION_READ_UNCOMMITTED,
+                IsolationLevel.READ_UNCOMMITTED,
+                Connection.TRANSACTION_READ_UNCOMMITTED);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, String
+                .valueOf(Connection.TRANSACTION_READ_COMMITTED),
+                IsolationLevel.READ_COMMITTED,
+                Connection.TRANSACTION_READ_COMMITTED);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                Connection.TRANSACTION_READ_COMMITTED,
+                IsolationLevel.READ_COMMITTED,
+                Connection.TRANSACTION_READ_COMMITTED);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, String
+                .valueOf(Connection.TRANSACTION_REPEATABLE_READ),
+                IsolationLevel.REPEATABLE_READ,
+                Connection.TRANSACTION_REPEATABLE_READ);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                Connection.TRANSACTION_REPEATABLE_READ,
+                IsolationLevel.REPEATABLE_READ,
+                Connection.TRANSACTION_REPEATABLE_READ);
+
+            isolationHintTest(oem, fPlan, fConfig, hintName, String
+                .valueOf(Connection.TRANSACTION_SERIALIZABLE),
+                IsolationLevel.SERIALIZABLE,
+                Connection.TRANSACTION_SERIALIZABLE);
+            isolationHintTest(oem, fPlan, fConfig, hintName,
+                Connection.TRANSACTION_SERIALIZABLE,
+                IsolationLevel.SERIALIZABLE,
+                Connection.TRANSACTION_SERIALIZABLE);
+        }
+        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 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);
+            assertEquals(IsolationLevel.DEFAULT, fPlan.getIsolation());
+            assertEquals(-1, fConfig.getIsolation());
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    @SuppressWarnings("deprecation")
+    private void isolationHintTest(OpenJPAEntityManager oem,
+        JDBCFetchPlan fPlan, JDBCFetchConfigurationImpl fConfig, String hint,
+        Object value, Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getIsolation());
+        assertEquals(expected, fConfig.getIsolation());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.LRSSizeAlgorithm" hint
+     */
+    public void testFetchPlanLRSSizeAlgorithmHint() {
+        String hintName = "openjpa.FetchPlan.LRSSizeAlgorithm";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, "query",
+            LRSSizeAlgorithm.QUERY, LRSSizes.SIZE_QUERY);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizeAlgorithm.QUERY.name(),
+            LRSSizeAlgorithm.QUERY, LRSSizes.SIZE_QUERY);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizeAlgorithm.QUERY,
+            LRSSizeAlgorithm.QUERY, LRSSizes.SIZE_QUERY);
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, "last",
+            LRSSizeAlgorithm.LAST, LRSSizes.SIZE_LAST);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizeAlgorithm.LAST.name(),
+            LRSSizeAlgorithm.LAST, LRSSizes.SIZE_LAST);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizeAlgorithm.LAST,
+            LRSSizeAlgorithm.LAST, LRSSizes.SIZE_LAST);
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, "unknown",
+            LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizeAlgorithm.UNKNOWN
+            .name(), LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizeAlgorithm.UNKNOWN,
+            LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
+
+        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()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.LRSSize" hint
+     */
+    @SuppressWarnings("deprecation")
+    public void testFetchPlanLRSSizeHint() {
+        String hintName = "openjpa.FetchPlan.LRSSize";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, String
+            .valueOf(LRSSizes.SIZE_QUERY), LRSSizeAlgorithm.QUERY,
+            LRSSizes.SIZE_QUERY);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizes.SIZE_QUERY,
+            LRSSizeAlgorithm.QUERY, LRSSizes.SIZE_QUERY);
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, String
+            .valueOf(LRSSizes.SIZE_LAST), LRSSizeAlgorithm.LAST,
+            LRSSizes.SIZE_LAST);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizes.SIZE_LAST,
+            LRSSizeAlgorithm.LAST, LRSSizes.SIZE_LAST);
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, String
+            .valueOf(LRSSizes.SIZE_UNKNOWN), LRSSizeAlgorithm.UNKNOWN,
+            LRSSizes.SIZE_UNKNOWN);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizes.SIZE_UNKNOWN,
+            LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
+
+        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(LRSSizeAlgorithm.QUERY, fPlan.getLRSSizeAlgorithm());
+            assertEquals(LRSSizes.SIZE_QUERY, fPlan.getLRSSize());
+            assertEquals(LRSSizes.SIZE_QUERY, fConfig.getLRSSize());
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.LRSSize" hint
+     */
+    @SuppressWarnings("deprecation")
+    public void testJdbcLRSSizeHint() {
+        String hintName = "openjpa.jdbc.LRSSize";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager) em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, String
+            .valueOf(LRSSizes.SIZE_QUERY), LRSSizeAlgorithm.QUERY,
+            LRSSizes.SIZE_QUERY);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizes.SIZE_QUERY,
+            LRSSizeAlgorithm.QUERY, LRSSizes.SIZE_QUERY);
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, String
+            .valueOf(LRSSizes.SIZE_LAST), LRSSizeAlgorithm.LAST,
+            LRSSizes.SIZE_LAST);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizes.SIZE_LAST,
+            LRSSizeAlgorithm.LAST, LRSSizes.SIZE_LAST);
+
+        lrsSizeHintTest(fPlan, fConfig, hintName, String
+            .valueOf(LRSSizes.SIZE_UNKNOWN), LRSSizeAlgorithm.UNKNOWN,
+            LRSSizes.SIZE_UNKNOWN);
+        lrsSizeHintTest(fPlan, fConfig, hintName, LRSSizes.SIZE_UNKNOWN,
+            LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
+
+        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(LRSSizeAlgorithm.QUERY, fPlan.getLRSSizeAlgorithm());
+            assertEquals(LRSSizes.SIZE_QUERY, fPlan.getLRSSize());
+            assertEquals(LRSSizes.SIZE_QUERY, fConfig.getLRSSize());
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    @SuppressWarnings("deprecation")
+    private void lrsSizeHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getLRSSizeAlgorithm());
+        assertEquals(expected, fPlan.getLRSSize());
+        assertEquals(expected, fConfig.getLRSSize());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.MaxFetchDepth" hint
+     */
+    public void testFetchPlanMaxFetchDepthHint() {
+        String hintName = "openjpa.FetchPlan.MaxFetchDepth";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, "-1", -1);
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, -1, -1);
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, "500", 500);
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, 500, 500);
+
+        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, FetchConfiguration.DEFAULT, true);
+            assertEquals(-1, fPlan.getMaxFetchDepth());
+            assertEquals(-1, fConfig.getMaxFetchDepth());
+        } catch (IllegalArgumentException e) {
+            fail("Unexpected IllegalArgumentException.");
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.MaxFetchDepth" hint
+     */
+    public void testMaxFetchDepthHint() {
+        String hintName = "openjpa.MaxFetchDepth";
+
+        EntityManager em = emf.createEntityManager();
+        OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
+        JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.getFetchPlan();
+        JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl)
+            ((EntityManagerImpl) oem).getBroker().getFetchConfiguration();
+
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, "-1", -1);
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, -1, -1);
+        maxFetchDepthHintTest(fPlan, fConfig, hintName, "100", 100);
+        maxFetchDepthHintTest(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, FetchConfiguration.DEFAULT, true);
+            assertEquals(-1, fPlan.getMaxFetchDepth());
+            assertEquals(-1, fConfig.getMaxFetchDepth());
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    private void maxFetchDepthHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expected, fPlan.getMaxFetchDepth());
+        assertEquals(expected, fConfig.getMaxFetchDepth());
+    }
+
+    /* Good
+     * Test "openjpa.LockTimeout" hint
+     */
+    public void testLockTimeoutHint() {
+        String hintName = "openjpa.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, "100", 100);
+        lockTimeoutHintTest(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()
+                .getLockTimeout();
+            assertEquals(defTimeout, fPlan.getLockTimeout());
+            assertEquals(defTimeout, fConfig.getLockTimeout());
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.LockTimeout" hint
+     */
+    public void testFetchPlanLockTimeoutHint() {
+        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();
+    }
+
+    /* Good
+     * Test "javax.persistence.lock.timeout" hint
+     */
+    public void testJavaxLockTimeoutHint() {
+        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();
+    }
+
+    private void lockTimeoutHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expected, fPlan.getLockTimeout());
+        assertEquals(expected, fConfig.getLockTimeout());
+    }
+
+    /* Good
+     * Test "openjpa.QueryTimeout" hint
+     */
+    public void testQueryTimeoutHint() {
+        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();
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.QueryTimeout" hint
+     */
+    public void testFetchPlanQueryTimeoutHint() {
+        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();
+    }
+
+    /* Good
+     * Test "javax.persistence.query.timeout" hint
+     */
+    public void testJavaxQueryTimeoutHint() {
+        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();
+    }
+
+    private void queryTimeoutHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expected, fPlan.getQueryTimeout());
+        assertEquals(expected, fConfig.getQueryTimeout());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.ResultSetType" hint
+     */
+    public void testFetchPlanResultSetTypeHint() {
+        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);
+        resultSetTypeHintTest(fPlan, fConfig, hintName,
+            ResultSetType.FORWARD_ONLY, ResultSetType.FORWARD_ONLY,
+            ResultSet.TYPE_FORWARD_ONLY);
+
+        resultSetTypeHintTest(fPlan, fConfig, hintName,
+            ResultSetType.SCROLL_SENSITIVE.name(),
+            ResultSetType.SCROLL_SENSITIVE, ResultSet.TYPE_SCROLL_SENSITIVE);
+        resultSetTypeHintTest(fPlan, fConfig, hintName,
+            ResultSetType.SCROLL_SENSITIVE, ResultSetType.SCROLL_SENSITIVE,
+            ResultSet.TYPE_SCROLL_SENSITIVE);
+
+        resultSetTypeHintTest(fPlan, fConfig, hintName,
+            ResultSetType.SCROLL_INSENSITIVE.name(),
+            ResultSetType.SCROLL_INSENSITIVE,
+            ResultSet.TYPE_SCROLL_INSENSITIVE);
+        resultSetTypeHintTest(fPlan, fConfig, hintName,
+            ResultSetType.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()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.ResultSetType" hint
+     */
+    public void testJdbcResultSetTypeHint() {
+        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();
+    }
+
+    private void resultSetTypeHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getResultSetType());
+        assertEquals(expected, fConfig.getResultSetType());
+    }
+
+    /* Good
+     * Test "openjpa.FetchPlan.SubclassFetchMode" hint
+     */
+    public void testFetchPlanSubclassFetchModeHint() {
+        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
+            .name(), FetchMode.NONE, EagerFetchModes.EAGER_NONE);
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.NONE,
+            FetchMode.NONE, EagerFetchModes.EAGER_NONE);
+
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, "parallel",
+            FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.PARALLEL
+            .name(), FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.PARALLEL,
+            FetchMode.PARALLEL, EagerFetchModes.EAGER_PARALLEL);
+
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, "join",
+            FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.JOIN
+            .name(), FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
+        subclassFetchModeHintTest(fPlan, fConfig, hintName, FetchMode.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()));
+        }
+        em.close();
+    }
+
+    /* Good
+     * Test "openjpa.jdbc.SubclassFetchMode" hint
+     */
+    public void testJdbcSubclassFetchModeHint() {
+        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();
+    }
+
+    private void subclassFetchModeHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedValue, int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedValue, fPlan.getSubclassFetchMode());
+        assertEquals(expected, fConfig.getSubclassFetchMode());
+    }
+
+    /* Good
+     * Test "openjpa.FlushBeforeQueries" hint
+     */
+    public void testFlushBeforeQueriesHint() {
+        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();
+    }
+
+    private void flushBeforeQueriesHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        int expected) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expected, fConfig.getFlushBeforeQueries());
+    }
+
+    /* Good
+     * Test "openjpa.ReadLockLevel" hint
+     */
+    public void testReadLockLevelHint() {
+        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.OPTIMISTIC,
+            MixedLockLevels.LOCK_READ);
+        readLockLevelHintTest(fPlan, fConfig, hintName,
+            MixedLockLevels.LOCK_READ, LockModeType.OPTIMISTIC,
+            MixedLockLevels.LOCK_READ);
+
+        readLockLevelHintTest(fPlan, fConfig, hintName, String
+            .valueOf(MixedLockLevels.LOCK_WRITE),
+            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
+            MixedLockLevels.LOCK_WRITE);
+        readLockLevelHintTest(fPlan, fConfig, hintName,
+            MixedLockLevels.LOCK_WRITE,
+            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
+            MixedLockLevels.LOCK_WRITE);
+
+        readLockLevelHintTest(fPlan, fConfig, hintName, String
+            .valueOf(MixedLockLevels.LOCK_OPTIMISTIC), LockModeType.OPTIMISTIC,
+            MixedLockLevels.LOCK_OPTIMISTIC);
+        readLockLevelHintTest(fPlan, fConfig, hintName, 10,
+            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", 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(MixedLockLevels.LOCK_READ, fConfig.getReadLockLevel());
+        } catch (Exception e) {
+            fail("Unexpected " + e.getClass().getName());
+        }
+        em.getTransaction().rollback();
+        em.close();
+    }
+
+    private void readLockLevelHintTest(JDBCFetchPlan fPlan,
+        JDBCFetchConfigurationImpl fConfig, String hint, Object value,
+        Object expectedMode, int expectedLevel) {
+        fPlan.setHint(hint, value);
+        Object getValue = fPlan.getHint(hint);
+        assertEquals(value.getClass(), getValue.getClass());
+        assertEquals(value, getValue);
+        assertEquals(expectedMode, fPlan.getReadLockMode());
+        assertEquals(expectedLevel, fConfig.getReadLockLevel());
+    }
+
+    /* Good
+     * Test "openjpa.WriteLockLevel" hint
+     */
+    public void testWriteLockLevelHint() {
+        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.OPTIMISTIC,
+            MixedLockLevels.LOCK_READ);
+        writeLockLevelHintTest(fPlan, fConfig, hintName,
+            MixedLockLevels.LOCK_READ, LockModeType.OPTIMISTIC,
+            MixedLockLevels.LOCK_READ);
+
+        writeLockLevelHintTest(fPlan, fConfig, hintName, String
+            .valueOf(MixedLockLevels.LOCK_WRITE),
+            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
+            MixedLockLevels.LOCK_WRITE);
+        writeLockLevelHintTest(fPlan, fConfig, hintName,
+            MixedLockLevels.LOCK_WRITE,
+            LockModeType.OPTIMISTIC_FORCE_INCREMENT,
+            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", 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);

[... 499 lines stripped ...]


Mime
View raw message