You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by pp...@apache.org on 2010/01/15 06:23:16 UTC

svn commit: r899529 [1/2] - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ openjpa-persiste...

Author: ppoddar
Date: Fri Jan 15 05:23:15 2010
New Revision: 899529

URL: http://svn.apache.org/viewvc?rev=899529&view=rev
Log:
OPENJPA-900: Reduce reflection in hint processing. Redesign with explicit hint keys.

Added:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java   (with props)
Removed:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/FetchPlanHintHandler.java
Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingFetchConfiguration.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/FetchMode.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ResultSetType.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MixedLockLevelsHelper.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/conf/JDBCProductDerivation.java Fri Jan 15 05:23:15 2010
@@ -18,14 +18,18 @@
  */
 package org.apache.openjpa.jdbc.conf;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.openjpa.conf.BrokerFactoryValue;
 import org.apache.openjpa.conf.OpenJPAProductDerivation;
 import org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory;
+import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
 import org.apache.openjpa.jdbc.sql.MySQLDictionary;
 import org.apache.openjpa.jdbc.sql.OracleDictionary;
 import org.apache.openjpa.lib.conf.AbstractProductDerivation;
@@ -37,14 +41,8 @@
 public class JDBCProductDerivation extends AbstractProductDerivation
     implements OpenJPAProductDerivation {
 
-    private static Set<String> supportedQueryHints = new HashSet<String>(2);
-
-    static {
-        supportedQueryHints.add(MySQLDictionary.SELECT_HINT);
-        supportedQueryHints.add(OracleDictionary.SELECT_HINT);
-        supportedQueryHints = Collections.unmodifiableSet(supportedQueryHints);
-    }
-
+    public static final String PREFIX = "openjpa.jdbc"; 
+    
     public void putBrokerFactoryAliases(Map m) {
         m.put("jdbc", JDBCBrokerFactory.class.getName());
     }
@@ -62,8 +60,28 @@
         return false;
     }
     
+    /**
+     * Hint keys correspond to some (not all) bean-style mutable property name in JDBCFetchConfiguration.
+     * The fully qualified key is prefixed with <code>openjpa.jdbc</code>.
+     */
+    private static Set<String> _hints = new HashSet<String>();
+    static {
+        _hints.add(PREFIX + ".EagerFetchMode");
+        _hints.add(PREFIX + ".FetchDirection");
+        _hints.add(PREFIX + ".TransactionIsolation");
+        _hints.add(PREFIX + ".JoinSyntax");
+        _hints.add(PREFIX + ".LRSSize");
+        _hints.add(PREFIX + ".ResultSetType");
+        _hints.add(PREFIX + ".SubclassFetchMode");
+        
+        _hints.add(MySQLDictionary.SELECT_HINT);
+        _hints.add(OracleDictionary.SELECT_HINT);
+        
+        _hints = Collections.unmodifiableSet(_hints);
+    }
+
     @Override
     public Set<String> getSupportedQueryHints() {
-        return supportedQueryHints;
+        return _hints;
     }
 }

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingFetchConfiguration.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingFetchConfiguration.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingFetchConfiguration.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DelegatingFetchConfiguration.java Fri Jan 15 05:23:15 2010
@@ -484,25 +484,25 @@
         }
     }
     
-    public void setHint(String name, Object value, boolean validate) {
+    public void setHint(String name, Object value, Object original) {
         try {
-            _fetch.setHint(name, value, validate);
+            _fetch.setHint(name, value, original);
         } catch (RuntimeException re) {
             throw translate(re);
         }
     }
 
-    public Object getHint(String name) {
+    public boolean isHintSet(String key) {
         try {
-            return _fetch.getHint(name);
+            return _fetch.isHintSet(key);
         } catch (RuntimeException re) {
             throw translate(re);
         }
     }
     
-    public void addHint(String name, Object value) {
+    public Object getHint(String name) {
         try {
-            _fetch.addHint(name, value);
+            return _fetch.getHint(name);
         } catch (RuntimeException re) {
             throw translate(re);
         }
@@ -515,7 +515,7 @@
             throw translate(re);
         }
     }
-
+    
     public int requiresFetch(FieldMetaData fmd) {
         try {
             return _fetch.requiresFetch(fmd);

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/QueryImpl.java Fri Jan 15 05:23:15 2010
@@ -126,7 +126,8 @@
 
     // remember the list of all the results we have returned so we
     // can free their resources when close or closeAll is called
-    private transient final Collection<ResultList<?>> _resultLists = new ReferenceHashSet(ReferenceHashSet.WEAK);
+    private transient final Collection<RemoveOnCloseResultList> _resultLists = 
+        new ReferenceHashSet(ReferenceHashSet.WEAK);
 
     /**
      * Construct a query managed by the given broker.
@@ -1239,7 +1240,7 @@
         boolean detach = (_broker.getAutoDetach() &
             AutoDetach.DETACH_NONTXREAD) > 0 && !_broker.isActive();
         boolean lrs = range.lrs && !ex.isAggregate(q) && !ex.hasGrouping(q);
-        ResultList res = (!detach && lrs) ? _fc.newResultList(rop)
+        ResultList<?> res = (!detach && lrs) ? _fc.newResultList(rop)
             : new EagerResultList(rop);
         res.setUserObject(new Object[]{rop,ex});
         _resultLists.add(decorateResultList(res));
@@ -1249,7 +1250,7 @@
     /**
      * Optionally decorate the native result.
      */
-    protected ResultList decorateResultList(ResultList res) {
+    protected RemoveOnCloseResultList decorateResultList(ResultList<?> res) {
         return new RemoveOnCloseResultList(res);
     }
 
@@ -1260,7 +1261,7 @@
         if (_packer != null)
             return _packer;
 
-        Class resultClass = (_resultClass != null) ? _resultClass
+        Class<?> resultClass = (_resultClass != null) ? _resultClass
             : ex.getResultClass(q);
         if (resultClass == null)
             return null;
@@ -1279,7 +1280,7 @@
                 // into some result class
                 _packer = new ResultPacker(_class, getAlias(), resultClass);
             } else if (resultClass != null) { // projection
-                Class[] types = ex.getProjectionTypes(q);
+                Class<?>[] types = ex.getProjectionTypes(q);
                 _packer = new ResultPacker(types, aliases, resultClass);
             }
         }
@@ -1346,9 +1347,9 @@
 
     public static boolean isAccessPathDirty(Broker broker,
         ClassMetaData[] accessMetas) {
-        Collection persisted = broker.getPersistedTypes();
-        Collection updated = broker.getUpdatedTypes();
-        Collection deleted = broker.getDeletedTypes();
+        Collection<Class<?>> persisted = broker.getPersistedTypes();
+        Collection<Class<?>> updated = broker.getUpdatedTypes();
+        Collection<Class<?>> deleted = broker.getDeletedTypes();
         if (persisted.isEmpty() && updated.isEmpty() && deleted.isEmpty())
             return false;
 
@@ -1358,7 +1359,7 @@
             return true;
 
         // compare dirty classes to the access path classes
-        Class accClass;
+        Class<?> accClass;
         for (int i = 0; i < accessMetas.length; i++) {
             if (accessMetas[i] == null)
                 continue;
@@ -1369,14 +1370,14 @@
                 return true;
 
             // check for dirty subclass
-            for (Iterator dirty = persisted.iterator(); dirty.hasNext();)
-                if (accClass.isAssignableFrom((Class) dirty.next()))
+            for (Iterator<Class<?>> dirty = persisted.iterator(); dirty.hasNext();)
+                if (accClass.isAssignableFrom(dirty.next()))
                     return true;
-            for (Iterator dirty = updated.iterator(); dirty.hasNext();)
-                if (accClass.isAssignableFrom((Class) dirty.next()))
+            for (Iterator<Class<?>> dirty = updated.iterator(); dirty.hasNext();)
+                if (accClass.isAssignableFrom(dirty.next()))
                     return true;
-            for (Iterator dirty = deleted.iterator(); dirty.hasNext();)
-                if (accClass.isAssignableFrom((Class) dirty.next()))
+            for (Iterator<Class<?>> dirty = deleted.iterator(); dirty.hasNext();)
+                if (accClass.isAssignableFrom(dirty.next()))
                     return true;
         }
 
@@ -1401,8 +1402,8 @@
             assertOpen();
 
             RemoveOnCloseResultList res;
-            for (Iterator itr = _resultLists.iterator(); itr.hasNext();) {
-                res = (RemoveOnCloseResultList) itr.next();
+            for (Iterator<RemoveOnCloseResultList> itr = _resultLists.iterator(); itr.hasNext();) {
+                res = itr.next();
                 if (force || res.isProviderOpen())
                     res.close(false);
             }
@@ -1470,9 +1471,9 @@
             // don't share mutable objects
             _fc.copy(q._fc);
             if (q._filtListeners != null)
-                _filtListeners = new HashMap(q._filtListeners);
+                _filtListeners = new HashMap<String,FilterListener>(q._filtListeners);
             if (q._aggListeners != null)
-                _aggListeners = new HashMap(q._aggListeners);
+                _aggListeners = new HashMap<String,AggregateListener>(q._aggListeners);
             return true;
         } finally {
             unlock();
@@ -1500,7 +1501,7 @@
         }
     }
 
-    public Class[] getProjectionTypes() {
+    public Class<?>[] getProjectionTypes() {
         lock();
         try {
             return compileForExecutor().getProjectionTypes(_storeQuery);

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/FetchMode.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/FetchMode.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/FetchMode.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/FetchMode.java Fri Jan 15 05:23:15 2010
@@ -19,6 +19,8 @@
 package org.apache.openjpa.persistence.jdbc;
 
 import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
+import org.apache.openjpa.kernel.FetchConfiguration;
+import org.apache.openjpa.persistence.OpenJPAEnum;
 
 /**
  * Type of fetching to employ.
@@ -27,18 +29,20 @@
  * @since 0.4.0
  * @published
  */
-public enum FetchMode {
-    NONE(EagerFetchModes.EAGER_NONE),
-    JOIN(EagerFetchModes.EAGER_JOIN),
-    PARALLEL(EagerFetchModes.EAGER_PARALLEL);
+public enum FetchMode implements OpenJPAEnum<FetchMode>{
+    NONE(EagerFetchModes.EAGER_NONE, "none"),
+    JOIN(EagerFetchModes.EAGER_JOIN, "join"),
+    PARALLEL(EagerFetchModes.EAGER_PARALLEL, "parallel");
 
     private final int eagerFetchConstant;
-
-    private FetchMode(int value) {
+    private final String[] _names;
+    
+    private FetchMode(int value, String... names) {
         eagerFetchConstant = value;
+        _names = names;
     }
 
-    int toKernelConstant() {
+    public int toKernelConstant() {
         return eagerFetchConstant;
     }
 
@@ -57,4 +61,27 @@
                 throw new IllegalArgumentException(kernelConstant + "");
         }
     }
+    
+    public int convertToKernelConstant(String s) {
+        return FetchMode.toKernelConstantFromString(s);
+    }
+    
+    public int convertToKernelConstant(int i) {
+        if (i == FetchConfiguration.DEFAULT)
+            return i;
+        for (FetchMode mode : FetchMode.values()) {
+            if (mode.eagerFetchConstant == i)
+                return i;
+        }
+        throw new IllegalArgumentException(i + " is invalid value for FetchMode");
+    }
+    
+    public static int toKernelConstantFromString(String s) {
+        for (FetchMode level : FetchMode.values()) {
+            for (String name : level._names)
+               if (name.equalsIgnoreCase(s) || String.valueOf(level.toKernelConstant()).equals(s))
+                   return level.toKernelConstant();
+        }
+        throw new IllegalArgumentException(s + " is not a valid name for " + FetchMode.class.getName());
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/JDBCFetchPlanImpl.java Fri Jan 15 05:23:15 2010
@@ -18,14 +18,21 @@
  */
 package org.apache.openjpa.persistence.jdbc;
 
+import java.sql.ResultSet;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.persistence.LockModeType;
 
 import org.apache.openjpa.jdbc.kernel.DelegatingJDBCFetchConfiguration;
+import org.apache.openjpa.jdbc.kernel.EagerFetchModes;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
+import org.apache.openjpa.jdbc.sql.JoinSyntaxes;
 import org.apache.openjpa.kernel.DelegatingFetchConfiguration;
 import org.apache.openjpa.kernel.FetchConfiguration;
 import org.apache.openjpa.persistence.FetchPlanImpl;
+import org.apache.openjpa.persistence.HintValueConverter;
 import org.apache.openjpa.persistence.PersistenceExceptions;
 
 /**
@@ -40,6 +47,49 @@
     implements JDBCFetchPlan {
 
     private DelegatingJDBCFetchConfiguration _fetch;
+    static {
+        registerHint(new String[]{"openjpa.FetchPlan.EagerFetchMode", "openjpa.jdbc.EagerFetchMode"},
+            new HintValueConverter.StringToInteger(new String[]{"none", "0", "join", "1", "parallel", "2"}, 
+                new int[]{EagerFetchModes.EAGER_NONE, EagerFetchModes.EAGER_NONE, 
+                          EagerFetchModes.EAGER_JOIN, EagerFetchModes.EAGER_JOIN,
+                          EagerFetchModes.EAGER_PARALLEL,EagerFetchModes.EAGER_PARALLEL}),
+            new HintValueConverter.EnumToInteger(FetchMode.class, 
+                new int[]{EagerFetchModes.EAGER_NONE, EagerFetchModes.EAGER_JOIN, EagerFetchModes.EAGER_PARALLEL}));
+        registerHint(new String[]{"openjpa.JoinSyntax", "openjpa.jdbc.JoinSyntax","openjpa.FetchPlan.JoinSyntax"}, 
+            new HintValueConverter.EnumToInteger(JoinSyntax.class,
+                new int[]{JoinSyntaxes.SYNTAX_SQL92, JoinSyntaxes.SYNTAX_TRADITIONAL, JoinSyntaxes.SYNTAX_DATABASE}),
+            new HintValueConverter.StringToInteger(new String[]{"sql92", "0", "traditional", "1", "database", "2"}, 
+                new int[]{JoinSyntaxes.SYNTAX_SQL92, JoinSyntaxes.SYNTAX_SQL92, 
+                    JoinSyntaxes.SYNTAX_TRADITIONAL, JoinSyntaxes.SYNTAX_TRADITIONAL,
+                    JoinSyntaxes.SYNTAX_DATABASE, JoinSyntaxes.SYNTAX_DATABASE}));
+        registerHint(new String[]{"openjpa.FetchDirection", "openjpa.jdbc.FetchDirection",
+                "openjpa.FetchPlan.FetchDirection"}, 
+                new HintValueConverter.EnumToInteger(FetchDirection.class,
+                    new int[]{ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, ResultSet.FETCH_UNKNOWN}),    
+                new HintValueConverter.StringToInteger(new String[]{"forward", String.valueOf(ResultSet.FETCH_FORWARD), 
+                                                       "reverse", String.valueOf(ResultSet.FETCH_REVERSE), 
+                                                       "unknown", String.valueOf(ResultSet.FETCH_UNKNOWN)}, 
+                    new int[]{ResultSet.FETCH_FORWARD, ResultSet.FETCH_FORWARD, 
+                        ResultSet.FETCH_REVERSE, ResultSet.FETCH_REVERSE,
+                        ResultSet.FETCH_UNKNOWN, ResultSet.FETCH_UNKNOWN}));
+        registerHint(new String[]{"openjpa.FetchPlan.Isolation", "openjpa.jdbc.TransactionIsolation"}, 
+                new HintValueConverter.OpenJPAEnumToInteger(IsolationLevel.DEFAULT));    
+        registerHint(new String[]{"openjpa.FetchPlan.LRSSizeAlgorithm", "openjpa.FetchPlan.LRSSize",
+        "openjpa.jdbc.LRSSize"}, 
+        new HintValueConverter.OpenJPAEnumToInteger(LRSSizeAlgorithm.QUERY));
+        registerHint(new String[]{"openjpa.FetchPlan.ResultSetType", "openjpa.jdbc.ResultSetType"}, 
+                new HintValueConverter.OpenJPAEnumToInteger(ResultSetType.FORWARD_ONLY));
+        registerHint(new String[]{"openjpa.FetchPlan.SubclassFetchMode", "openjpa.jdbc.SubclassFetchMode"}, 
+                new HintValueConverter.OpenJPAEnumToInteger(FetchMode.NONE));
+        
+//        "openjpa.FetchPlan.FetchDirection"
+//        _hints.add("openjpa.FetchPlan.LockScope");
+//        _hints.add("openjpa.FetchPlan.LockTimeout");
+//        _hints.add("openjpa.FetchPlan.MaxFetchDepth");
+//        _hints.add("openjpa.FetchPlan.QueryTimeout");
+//        _hints.add("openjpa.FetchPlan.ReadLockMode");
+//        _hints.add("openjpa.FetchPlan.WriteLockMode");
+    }
 
     /**
      * Constructor; supply delegate.

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ResultSetType.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ResultSetType.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ResultSetType.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/java/org/apache/openjpa/persistence/jdbc/ResultSetType.java Fri Jan 15 05:23:15 2010
@@ -20,13 +20,16 @@
 
 import java.sql.ResultSet;
 
+import org.apache.openjpa.kernel.FetchConfiguration;
+import org.apache.openjpa.persistence.OpenJPAEnum;
+
 /**
  * Type of result set to use.
  *
  * @since 1.0.0
  * @published
  */
-public enum ResultSetType {
+public enum ResultSetType implements OpenJPAEnum<ResultSetType>{
     FORWARD_ONLY(ResultSet.TYPE_FORWARD_ONLY),
     SCROLL_INSENSITIVE(ResultSet.TYPE_SCROLL_INSENSITIVE),
     SCROLL_SENSITIVE(ResultSet.TYPE_SCROLL_SENSITIVE);
@@ -37,7 +40,7 @@
         resultSetConstant = value;
     }
 
-    int toKernelConstant() {
+    public int toKernelConstant() {
         return resultSetConstant;
     }
 
@@ -56,4 +59,26 @@
                 throw new IllegalArgumentException(kernelConstant + "");
         }
     }
+    
+    public int convertToKernelConstant(String s) {
+        return ResultSetType.toKernelConstantFromString(s);
+    }
+    
+    public int convertToKernelConstant(int i) {
+        if (i == FetchConfiguration.DEFAULT)
+            return i;
+        for (ResultSetType level : ResultSetType.values()) {
+            if (level.resultSetConstant == i)
+                return i;
+        }
+        throw new IllegalArgumentException(i + " is invalid value for ResultSetType");
+    }
+    
+    public static int toKernelConstantFromString(String s) {
+        for (ResultSetType level : ResultSetType.values()) {
+            if (level.name().equalsIgnoreCase(s) || String.valueOf(level.toKernelConstant()).equals(s))
+                return level.toKernelConstant();
+        }
+        throw new IllegalArgumentException(s + " is not a valid name for " + ResultSetType.class.getName());
+    }
 }

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java (original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestFetchHints.java Fri Jan 15 05:23:15 2010
@@ -72,7 +72,6 @@
  *   openjpa.FlushBeforeQueries
  *   openjpa.LockTimeout
  *   openjpa.MaxFetchDepth
- *   openjpa.QueryCacheEnabled
  *   openjpa.QueryTimeout
  *   openjpa.ReadLockLevel
  *   openjpa.WriteLockLevel
@@ -110,8 +109,8 @@
         fetchBatchSizeHintTest(fPlan, fConfig, hintName, 100, 100);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "xxxxx", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "xxxxx");
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -119,7 +118,7 @@
         }
         try {
             fPlan.setFetchBatchSize(999);
-            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(fPlan.getFetchBatchSize(), -1);
         } catch (Exception e) {
             fail("Unexpected " + e.getClass().getName());
@@ -145,8 +144,8 @@
         fetchBatchSizeHintTest(fPlan, fConfig, hintName, 500, 500);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -154,7 +153,7 @@
         }
         try {
             fPlan.setFetchBatchSize(999);
-            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(fPlan.getFetchBatchSize(), -1);
         } catch (Exception e) {
             fail("Unexpected " + e.getClass().getName());
@@ -166,7 +165,7 @@
         JDBCFetchConfigurationImpl fConfig, String hint, Object value,
         int expected) {
         fConfig.setFetchBatchSize(999);
-        fPlan.setHint(hint, value, false);
+        fPlan.setHint(hint, value);
         Object getValue = fPlan.getHint(hint);
         assertEquals(value.getClass(), getValue.getClass());
         assertEquals(value, getValue);
@@ -208,24 +207,24 @@
             FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            fPlan.setHint(hintName, "12345");
+            fPlan.setHint(hintName, "67890");
             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);
+            fPlan.setHint(hintName, -2);
+            fPlan.setHint(hintName, -3);
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -268,31 +267,31 @@
             EagerFetchModes.EAGER_JOIN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            fPlan.setHint(hintName, "12345");
+            fPlan.setHint(hintName, "67890");
             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);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
                 IllegalArgumentException.class.isAssignableFrom(e.getClass()));
         }
         try {
-            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(fPlan.getEagerFetchMode(), FetchMode.PARALLEL);
         } catch (Exception e) {
               fail("Unexpected " + e.getClass().getName());
@@ -347,24 +346,24 @@
             JoinSyntax.DATABASE, JoinSyntaxes.SYNTAX_DATABASE);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            fPlan.setHint(hintName, "12345");
+            fPlan.setHint(hintName, "67890");
             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);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -406,31 +405,31 @@
             JoinSyntaxes.SYNTAX_DATABASE);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            fPlan.setHint(hintName, "12345");
+            fPlan.setHint(hintName, "67890");
             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);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
                 IllegalArgumentException.class.isAssignableFrom(e.getClass()));
         }
         try {
-            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(fConfig.getJoinSyntax(),
                 ((JDBCConfiguration) fConfig.getContext().getConfiguration())
                     .getDBDictionaryInstance().joinSyntax);
@@ -488,24 +487,24 @@
             ResultSet.FETCH_UNKNOWN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            fPlan.setHint(hintName, "12345");
+            fPlan.setHint(hintName, "67890");
             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);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -548,31 +547,31 @@
             ResultSet.FETCH_UNKNOWN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            fPlan.setHint(hintName, "12345");
+            fPlan.setHint(hintName, "67890");
             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);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
                 IllegalArgumentException.class.isAssignableFrom(e.getClass()));
         }
         try {
-            fPlan.setHint(hintName, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(fConfig.getFetchDirection(), ResultSet.FETCH_FORWARD);
         } catch (Exception e) {
             fail("Unexpected " + e.getClass().getName());
@@ -665,29 +664,30 @@
         }
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            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()));
         }
+        // Is not -1 is valid value for transaction isolation level?
+//        try {
+//            fPlan.setHint(hintName, -1);
+//            fPlan.setHint(hintName, -1);
+//            fail("Expecting a a IllegalArgumentException.");
+//        } catch (Exception e) {
+//            assertTrue("Caught expected exception",
+//                IllegalArgumentException.class.isAssignableFrom(e.getClass()));
+//        }
         em.close();
     }
 
@@ -756,31 +756,31 @@
                 Connection.TRANSACTION_SERIALIZABLE);
         }
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            fPlan.setHint(hintName, "xxxxx");
+            fPlan.setHint(hintName, "yyyyy");
             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);
+            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, -2, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(IsolationLevel.DEFAULT, fPlan.getIsolation());
             assertEquals(-1, fConfig.getIsolation());
         } catch (Exception e) {
@@ -835,27 +835,27 @@
             LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a a IllegalArgumentException.");
         } catch (Exception e) {
-            assertTrue("Caught expected exception",
+            assertTrue("Caught unexpected exception " + e,
                 IllegalArgumentException.class.isAssignableFrom(e.getClass()));
         }
         em.close();
@@ -893,35 +893,36 @@
             LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(LRSSizeAlgorithm.QUERY, fPlan.getLRSSizeAlgorithm());
             assertEquals(LRSSizes.SIZE_QUERY, fPlan.getLRSSize());
             assertEquals(LRSSizes.SIZE_QUERY, fConfig.getLRSSize());
         } catch (Exception e) {
+            e.printStackTrace();
             fail("Unexpected " + e.getClass().getName());
         }
         em.close();
@@ -959,35 +960,36 @@
             LRSSizeAlgorithm.UNKNOWN, LRSSizes.SIZE_UNKNOWN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(LRSSizeAlgorithm.QUERY, fPlan.getLRSSizeAlgorithm());
             assertEquals(LRSSizes.SIZE_QUERY, fPlan.getLRSSize());
             assertEquals(LRSSizes.SIZE_QUERY, fConfig.getLRSSize());
         } catch (Exception e) {
+            e.printStackTrace();
             fail("Unexpected " + e.getClass().getName());
         }
         em.close();
@@ -1024,15 +1026,15 @@
         maxFetchDepthHintTest(fPlan, fConfig, hintName, 500, 500);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(-1, fPlan.getMaxFetchDepth());
             assertEquals(-1, fConfig.getMaxFetchDepth());
         } catch (IllegalArgumentException e) {
@@ -1059,15 +1061,15 @@
         maxFetchDepthHintTest(fPlan, fConfig, hintName, 100, 100);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, FetchConfiguration.DEFAULT, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(-1, fPlan.getMaxFetchDepth());
             assertEquals(-1, fConfig.getMaxFetchDepth());
         } catch (Exception e) {
@@ -1107,23 +1109,23 @@
         lockTimeoutHintTest(fPlan, fConfig, hintName, 100, 100);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             int defTimeout = fConfig.getContext().getConfiguration()
                 .getLockTimeout();
             assertEquals(defTimeout, fPlan.getLockTimeout());
@@ -1154,23 +1156,23 @@
         lockTimeoutHintTest(fPlan, fConfig, hintName, 1500, 1500);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             int defTimeout = fConfig.getContext().getConfiguration()
                 .getLockTimeout();
             assertEquals(defTimeout, fPlan.getLockTimeout());
@@ -1201,23 +1203,23 @@
         lockTimeoutHintTest(fPlan, fConfig, hintName, 2000, 2000);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             int defTimeout = fConfig.getContext().getConfiguration()
                 .getLockTimeout();
             assertEquals(defTimeout, fPlan.getLockTimeout());
@@ -1259,23 +1261,23 @@
         queryTimeoutHintTest(fPlan, fConfig, hintName, 100, 100);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             int defTimeout = fConfig.getContext().getConfiguration()
                 .getQueryTimeout();
             assertEquals(defTimeout, fPlan.getQueryTimeout());
@@ -1306,23 +1308,23 @@
         queryTimeoutHintTest(fPlan, fConfig, hintName, 1500, 1500);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             int defTimeout = fConfig.getContext().getConfiguration()
                 .getQueryTimeout();
             assertEquals(defTimeout, fPlan.getQueryTimeout());
@@ -1353,23 +1355,23 @@
         queryTimeoutHintTest(fPlan, fConfig, hintName, 2000, 2000);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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, false);
-            fPlan.setHint(hintName, -3, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             int defTimeout = fConfig.getContext().getConfiguration()
                 .getQueryTimeout();
             assertEquals(defTimeout, fPlan.getQueryTimeout());
@@ -1426,27 +1428,27 @@
             ResultSet.TYPE_SCROLL_INSENSITIVE);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a a IllegalArgumentException.");
         } catch (Exception e) {
-            assertTrue("Caught expected exception",
+            assertTrue("Caught unexpected exception " + e,
                 IllegalArgumentException.class.isAssignableFrom(e.getClass()));
         }
         em.close();
@@ -1487,31 +1489,31 @@
             ResultSet.TYPE_SCROLL_INSENSITIVE);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(ResultSet.TYPE_FORWARD_ONLY, fConfig
                 .getResultSetType());
         } catch (Exception e) {
@@ -1565,24 +1567,24 @@
             FetchMode.JOIN, EagerFetchModes.EAGER_JOIN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -1625,31 +1627,31 @@
             EagerFetchModes.EAGER_JOIN);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(EagerFetchModes.EAGER_JOIN, fConfig
                 .getSubclassFetchMode());
         } catch (Exception e) {
@@ -1699,31 +1701,31 @@
             QueryFlushModes.FLUSH_WITH_CONNECTION);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             fConfig.getFlushBeforeQueries();
             assertEquals(QueryFlushModes.FLUSH_TRUE, fConfig
                 .getFlushBeforeQueries());
@@ -1821,31 +1823,31 @@
             MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(MixedLockLevels.LOCK_READ, fConfig.getReadLockLevel());
         } catch (Exception e) {
             fail("Unexpected " + e.getClass().getName());
@@ -1943,31 +1945,31 @@
             MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            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, true);
+            fPlan.setHint(hintName, FetchConfiguration.DEFAULT);
             assertEquals(MixedLockLevels.LOCK_WRITE, fConfig
                 .getWriteLockLevel());
         } catch (Exception e) {
@@ -2089,24 +2091,24 @@
             MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -2229,24 +2231,24 @@
             MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT);
 
         try {
-            fPlan.setHint(hintName, "xxxxx", false);
-            fPlan.setHint(hintName, "yyyyy", true);
+            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", false);
-            fPlan.setHint(hintName, "67890", true);
+            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, false);
-            fPlan.setHint(hintName, -2, true);
+            fPlan.setHint(hintName, -1);
+            fPlan.setHint(hintName, -2);
             fail("Expecting a a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",
@@ -2279,36 +2281,36 @@
         EntityManager em = emf.createEntityManager();
         OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
 
-        similarLockTimeoutHintsTest(oem, 333,
+        similarLockTimeoutHintsTest(oem, JavaxLockTimeout, 333,
             JavaxLockTimeout, 333,
             OpenJPALockTimeout, 111,
             FetchPlanLockTimeout, 222);
-        similarLockTimeoutHintsTest(oem, 333,
+        similarLockTimeoutHintsTest(oem, JavaxLockTimeout, 333,
             OpenJPALockTimeout, 111,
             FetchPlanLockTimeout, 222,
             JavaxLockTimeout, 333);
-        similarLockTimeoutHintsTest(oem, 333,
+        similarLockTimeoutHintsTest(oem, JavaxLockTimeout, 333,
             JavaxLockTimeout, 333,
             FetchPlanLockTimeout, 222,
             OpenJPALockTimeout, 111);
-        similarLockTimeoutHintsTest(oem, 222,
+        similarLockTimeoutHintsTest(oem, FetchPlanLockTimeout, 222,
             OpenJPALockTimeout, 111,
             FetchPlanLockTimeout, 222);
-        similarLockTimeoutHintsTest(oem, 222,
+        similarLockTimeoutHintsTest(oem, FetchPlanLockTimeout, 222,
             FetchPlanLockTimeout, 222,
             OpenJPALockTimeout, 111);
-        similarLockTimeoutHintsTest(oem, 111,
+        similarLockTimeoutHintsTest(oem, OpenJPALockTimeout, 111,
             OpenJPALockTimeout, 111);
-        similarLockTimeoutHintsTest(oem, 222,
+        similarLockTimeoutHintsTest(oem, FetchPlanLockTimeout, 222,
             FetchPlanLockTimeout, 222);
-        similarLockTimeoutHintsTest(oem, 333,
+        similarLockTimeoutHintsTest(oem, JavaxLockTimeout, 333,
             JavaxLockTimeout, 333);
 
         em.close();
     }
 
     @SuppressWarnings("deprecation")
-    private void similarLockTimeoutHintsTest(OpenJPAEntityManager oem,
+    private void similarLockTimeoutHintsTest(OpenJPAEntityManager oem, String winner, 
         Object expected, Object... hintNvalues) {
         JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.pushFetchPlan();
         JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl) fPlan
@@ -2321,8 +2323,10 @@
             String hintName = (String)hintNvalues[i];
             Object expectedValue = hintNvalues[i+1];
             Object getValue = fPlan.getHint(hintName);
-            assertEquals(expectedValue.getClass(), getValue.getClass());
-            assertEquals(expectedValue, getValue);
+            if (hintName.equals(winner)) {
+                assertEquals(expectedValue.getClass(), getValue.getClass());
+                assertEquals(expectedValue, getValue);
+            } 
         }
         assertEquals(expected, fPlan.getLockTimeout());
         assertEquals(expected, fConfig.getLockTimeout());
@@ -2341,36 +2345,36 @@
         EntityManager em = emf.createEntityManager();
         OpenJPAEntityManager oem = (OpenJPAEntityManager)em.getDelegate();
 
-        similarQueryTimeoutHintsTest(oem, 333,
+        similarQueryTimeoutHintsTest(oem, JavaxQueryTimeout, 333, 
             JavaxQueryTimeout, 333,
             OpenJPAQueryTimeout, 111,
             FetchPlanQueryTimeout, 222);
-        similarQueryTimeoutHintsTest(oem, 333,
+        similarQueryTimeoutHintsTest(oem, JavaxQueryTimeout, 333, 
             OpenJPAQueryTimeout, 111,
             FetchPlanQueryTimeout, 222,
             JavaxQueryTimeout, 333);
-        similarQueryTimeoutHintsTest(oem, 333,
+        similarQueryTimeoutHintsTest(oem, JavaxQueryTimeout, 333, 
             JavaxQueryTimeout, 333,
             FetchPlanQueryTimeout, 222,
             OpenJPAQueryTimeout, 111);
-        similarQueryTimeoutHintsTest(oem, 222,
+        similarQueryTimeoutHintsTest(oem, FetchPlanQueryTimeout, 222, 
             OpenJPAQueryTimeout, 111,
             FetchPlanQueryTimeout, 222);
-        similarQueryTimeoutHintsTest(oem, 222,
+        similarQueryTimeoutHintsTest(oem, FetchPlanQueryTimeout, 222, 
             FetchPlanQueryTimeout, 222,
             OpenJPAQueryTimeout, 111);
-        similarQueryTimeoutHintsTest(oem, 111,
+        similarQueryTimeoutHintsTest(oem, OpenJPAQueryTimeout, 111, 
             OpenJPAQueryTimeout, 111);
-        similarQueryTimeoutHintsTest(oem, 222,
+        similarQueryTimeoutHintsTest(oem, FetchPlanQueryTimeout, 222, 
             FetchPlanQueryTimeout, 222);
-        similarQueryTimeoutHintsTest(oem, 333,
+        similarQueryTimeoutHintsTest(oem, JavaxQueryTimeout, 333, 
             JavaxQueryTimeout, 333);
 
         em.close();
     }
 
     @SuppressWarnings("deprecation")
-    private void similarQueryTimeoutHintsTest(OpenJPAEntityManager oem,
+    private void similarQueryTimeoutHintsTest(OpenJPAEntityManager oem, String winner, 
         Object expected, Object... hintNvalues) {
         JDBCFetchPlan fPlan = (JDBCFetchPlan) oem.pushFetchPlan();
         JDBCFetchConfigurationImpl fConfig = (JDBCFetchConfigurationImpl) fPlan
@@ -2383,8 +2387,10 @@
             String hintName = (String)hintNvalues[i];
             Object expectedValue = hintNvalues[i+1];
             Object getValue = fPlan.getHint(hintName);
-            assertEquals(expectedValue.getClass(), getValue.getClass());
-            assertEquals(expectedValue, getValue);
+            if (hintName.equals(winner)) {
+                assertEquals(expectedValue.getClass(), getValue.getClass());
+                assertEquals(expectedValue, getValue);
+            }
         }
         assertEquals(expected, fPlan.getQueryTimeout());
         assertEquals(expected, fConfig.getQueryTimeout());
@@ -2404,8 +2410,6 @@
         fPlan.setHint("unrecognized.prop.name", "unrecognized.prop.value");
         assertEquals(null, fPlan.getHint("unrecognized.prop.name"));
 
-        fPlan.addHints(null);
-        fPlan.addHints(new HashMap<String,Object>());
 
         OpenJPAConfiguration conf = oem.getConfiguration();
         if (conf instanceof JDBCConfiguration
@@ -2416,16 +2420,13 @@
                 fail("Expecting a a IllegalArgumentException.");
             } catch (Exception e) {
                 assertTrue("Caught expected exception",
-                    IllegalArgumentException.class.isAssignableFrom(e
-                        .getClass()));
+                    IllegalArgumentException.class.isAssignableFrom(e.getClass()));
             }
         }
 
         try {
-            fPlan.setHint("openjpa.FetchPlan.Isolation", new Integer(13),
-                false);
-            fPlan.setHint("openjpa.FetchPlan.Isolation", new Integer(14),
-                true);
+            fPlan.setHint("openjpa.FetchPlan.Isolation", new Integer(13));
+            fPlan.setHint("openjpa.FetchPlan.Isolation", new Integer(14));
             fail("Expecting a IllegalArgumentException.");
         } catch (Exception e) {
             assertTrue("Caught expected exception",

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java Fri Jan 15 05:23:15 2010
@@ -1633,7 +1633,10 @@
             LockModeType lock, boolean requiresTxn) {
         // handle properties in map first
         configureCurrentCacheModes(fetch, properties);
-        fetch.addHints(properties);
+        if (properties != null) {
+            for (Map.Entry<String, Object> entry : properties.entrySet())
+                fetch.setHint(entry.getKey(), entry.getValue());
+        }
         // override with the specific lockMode, if needed.
         if (lock != null && lock != LockModeType.NONE) {
             if (requiresTxn) {

Added: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java?rev=899529&view=auto
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java (added)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java Fri Jan 15 05:23:15 2010
@@ -0,0 +1,189 @@
+/*
+ * 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;
+
+import java.util.Arrays;
+
+
+/**
+ * Converts a given user-specified value to a target type consumable by the kernel.
+ * Used by hint processing.
+ * 
+ * @author Pinaki Poddar
+ * @since 2.0.0
+ * @unpublished
+ */
+public interface HintValueConverter {
+    /**
+     * Convert the user-specified value to a kernel consumable value.
+     *  
+     * @param original the user-specified value
+     * @return an equivalent value consumable by a kernel construct.
+     * 
+     * @exception IllegalArgumentException if the given value can not be converted.
+     */
+    Object convert(Object original);
+    
+    /**
+     * Affirm if this receiver can convert the value of the given type.
+     */
+    boolean canConvert(Class<?> type);
+    
+    /**
+     * Convert the enum value to an enumerated set of constants.
+     * 
+     * @author Pinaki Poddar
+     *
+     */
+    static class EnumToInteger implements HintValueConverter {
+        private Class<? extends Enum<?>> _type;
+        private Integer[] map;
+        
+        public EnumToInteger(Class<? extends Enum<?>> enumType, int[] numbers) {
+            try {
+                _type = enumType;
+                Enum<?>[] values = (Enum<?>[])enumType.getMethod("values", null).invoke(null, (Class<?>[])null);
+                map = new Integer[values.length];
+                int i = 0;
+                for (Enum<?> v : values) {
+                    map[v.ordinal()] = numbers[i++];
+                }
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+        
+        public Object convert(Object e) {
+            if (e.getClass() == _type)
+                return map[((Enum<?>)e).ordinal()];
+            return e;
+        }
+        
+        public boolean canConvert(Class<?> type) {
+            return Enum.class.isAssignableFrom(type);
+        }
+    }
+    
+    /**
+     * Converts an OpenJPA specific enum to an equivalent kernel constant.
+     * 
+     * @author Pinaki Poddar
+     *
+     */
+    public static class OpenJPAEnumToInteger implements HintValueConverter {
+        private OpenJPAEnum<?> _prototype;
+        
+        public OpenJPAEnumToInteger(OpenJPAEnum<?> prototype) {
+            _prototype = prototype;
+        }
+            
+        public Object convert(Object e) {
+            if (e.getClass() == _prototype.getClass())
+                return ((OpenJPAEnum<Enum<?>>)e).toKernelConstant();
+            if (e instanceof String) {
+                return _prototype.convertToKernelConstant(e.toString());
+            }
+            if (e instanceof Integer) {
+                return _prototype.convertToKernelConstant((Integer)e);
+            }
+            return e;
+        }
+        
+        public boolean canConvert(Class<?> type) {
+            return OpenJPAEnum.class.isAssignableFrom(type) 
+                || type == String.class 
+                || type == Integer.class
+                || type == int.class;
+        }
+    }
+
+    /**
+     * Converts a String to an integer.
+     * 
+     * @author Pinaki Poddar
+     *
+     */
+    public static class StringToInteger implements HintValueConverter {
+        private String[] strings;
+        private Integer[] numbers;
+        
+        /**
+         * Construct a converter that will simply translate a numeric string to a integer.
+         */
+        public StringToInteger() {
+            
+        }
+        
+        /**
+         * Construct a converter that will translate any of the given strings to corresponding integer.
+         * Both arrays must not be null, must not contain null elements and must have the same dimension.
+         * 
+         * @param strings
+         * @param numbers
+         */
+        public StringToInteger(String[] strings, int[] numbers) {
+            if (strings == null || numbers == null || strings.length != numbers.length)
+                throw new IllegalArgumentException();
+            this.strings = new String[strings.length];
+            this.numbers = new Integer[numbers.length];
+            for (int i = 0; i < strings.length; i++) {
+                this.strings[i] = strings[i];
+                this.numbers[i] = numbers[i];
+            }
+        }
+        
+        public Object convert(Object s) {
+            if (s instanceof String == false)
+                return s;
+            String str = s.toString();
+            if (strings == null) {
+                try {
+                    return Integer.parseInt(str);
+                } catch (NumberFormatException e) {
+                    throw new IllegalArgumentException("Can not convert " + str + " . Expected a numeric string");
+                }
+            }
+            for (int i = 0; i < strings.length; i++)  {
+                if (strings[i].equalsIgnoreCase(str))
+                    return numbers[i];
+            }
+            throw new IllegalArgumentException("Can not convert " + str + " . Valid input is " + 
+                    Arrays.toString(strings));
+        }
+        
+        public boolean canConvert(Class<?> cls) {
+            return String.class == cls;
+        }
+    }
+    
+    public static class StringToBoolean implements HintValueConverter {
+        public Object convert(Object v) {
+            if (v instanceof String)
+                return Boolean.valueOf(v.toString());
+            if (v instanceof Boolean)
+                return v;
+            return v;
+        }
+        
+        public boolean canConvert(Class<?> cls) {
+            return String.class == cls || Boolean.class == cls || boolean.class == cls;
+        }
+    }
+
+}

Propchange: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/HintValueConverter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MixedLockLevelsHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MixedLockLevelsHelper.java?rev=899529&r1=899528&r2=899529&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MixedLockLevelsHelper.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/MixedLockLevelsHelper.java Fri Jan 15 05:23:15 2010
@@ -20,6 +20,7 @@
 
 import javax.persistence.LockModeType;
 
+import org.apache.openjpa.kernel.FetchConfiguration;
 import org.apache.openjpa.kernel.MixedLockLevels;
 
 /**
@@ -29,7 +30,7 @@
  * @author Albert Lee
  * @since 2.0.0
  */
-public class MixedLockLevelsHelper {
+public class MixedLockLevelsHelper implements HintValueConverter {
     /**
      * Translates javax.persistence LockModeType to internal lock level.
      */
@@ -50,6 +51,24 @@
             return MixedLockLevels.LOCK_PESSIMISTIC_WRITE;
         return MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT;
     }
+    
+    public static int toLockLevel(int mode) {
+        switch (mode) {
+        case MixedLockLevels.LOCK_OPTIMISTIC:
+        case MixedLockLevels.LOCK_OPTIMISTIC_FORCE_INCREMENT:
+        case MixedLockLevels.LOCK_PESSIMISTIC_FORCE_INCREMENT:
+        case MixedLockLevels.LOCK_PESSIMISTIC_READ:
+        case MixedLockLevels.LOCK_PESSIMISTIC_WRITE:
+        case MixedLockLevels.LOCK_NONE:
+        case MixedLockLevels.LOCK_READ:
+        case MixedLockLevels.LOCK_WRITE:
+        case FetchConfiguration.DEFAULT:
+            return mode;
+         default:
+             throw new IllegalArgumentException("Unknown lock level " + mode);
+        }
+    }
+
 
     /**
      * Translates internal lock level to javax.persistence LockModeType.
@@ -71,4 +90,30 @@
             return LockModeType.PESSIMISTIC_WRITE;
         return LockModeType.PESSIMISTIC_FORCE_INCREMENT;
     }
+
+    public boolean canConvert(Class<?> type) {
+        return type == LockModeType.class || type == String.class || type == Integer.class || type == int.class;
+    }
+
+    public Object convert(Object original) {
+        if (original instanceof LockModeType)
+            return MixedLockLevelsHelper.toLockLevel((LockModeType)original);
+        if (original instanceof String) {
+            try {
+                int value = Integer.parseInt(original.toString());
+                return MixedLockLevelsHelper.toLockLevel(value);
+            } catch (NumberFormatException nfe) {
+                if ("none".equalsIgnoreCase(original.toString())) {
+                    return MixedLockLevels.LOCK_NONE;
+                }
+                return MixedLockLevelsHelper.toLockLevel(
+                        LockModeType.valueOf(original.toString().toUpperCase().replace('-', '_')));
+            }
+        }
+        if (original instanceof Integer) {
+            return MixedLockLevelsHelper.toLockLevel((Integer)original);
+        }
+        
+        throw new IllegalArgumentException("can not convert " + original + " of " + original.getClass());
+    }
 }