You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by cu...@apache.org on 2010/10/27 20:39:54 UTC

svn commit: r1028064 - in /openjpa/trunk/openjpa-persistence/src/main: java/org/apache/openjpa/persistence/PersistenceProductDerivation.java resources/org/apache/openjpa/persistence/localizer.properties

Author: curtisr7
Date: Wed Oct 27 18:39:53 2010
New Revision: 1028064

URL: http://svn.apache.org/viewvc?rev=1028064&view=rev
Log:
OPENJPA-1855: Log warning if javax.persistence.cache.retrieve/storeMode is used incorrectly.

Modified:
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
    openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java?rev=1028064&r1=1028063&r2=1028064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java (original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java Wed Oct 27 18:39:53 2010
@@ -98,6 +98,10 @@ public class PersistenceProductDerivatio
     
     public static final String PREFIX = "javax.persistence"; 
     
+    // These are properties that are invalid to be configured at the provider level. 
+    private static final String[] _invalidPersistenceProperties =
+        new String[] { PREFIX + ".cache.storeMode", PREFIX + ".cache.retrieveMode" };
+    
     private static Set<String> _hints = new HashSet<String>();
     
     // Provider name to filter out PUs that don't belong to this derivation.
@@ -706,6 +710,15 @@ public class PersistenceProductDerivatio
             }
             
             Log log = conf.getConfigurationLog();
+            if (log.isWarnEnabled()) {
+                Map<?, ?> props = getProperties();
+                for (String propKey : _invalidPersistenceProperties) {
+                    Object propValue = props.get(propKey);
+                    if (propValue != null) {
+                        log.warn(_loc.get("invalid-persistence-property", new Object[] { propKey, propValue }));
+                    }
+                }
+            }
             if (log.isTraceEnabled()) {
                 String src = (_source == null) ? "?" : _source;
                 log.trace(_loc.get("conf-load", src, getProperties()));

Modified: openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties?rev=1028064&r1=1028063&r2=1028064&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties (original)
+++ openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties Wed Oct 27 18:39:53 2010
@@ -241,3 +241,6 @@ NamedQuery {0} "{1}" in class "{2}". Set
 invalid-oid: An incorrect object id type was encountered. Expected "{0}" but was passed "{1}".
 invalid-cfname-prop: The "{0}" configuration option is not valid when the DataSource JNDI name(s) are provided \
 	when you create an EntityManager. Found jtaDataSource: "{1}", nonJtaDataSource: "{2}". 
+invalid-persistence-property: The property "{0}={1}" was detected while loading configuration. However, it is invalid \
+and cannot be configured at the provider level, so it is ignored. Please consult the documentation for the correct \
+usage of this property.