OPENJPA-1855: Log warning if javax.persistence.cache.retrieve/storeMode is used incorrectly.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@1028064 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Richard G. Curtis 2010-10-27 18:39:53 +00:00
parent 47d7b1d778
commit daa090c11b
2 changed files with 16 additions and 0 deletions

View File

@ -98,6 +98,10 @@ public class PersistenceProductDerivation
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 PersistenceProductDerivation
}
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()));

View File

@ -241,3 +241,6 @@ NamedQuery {0} "{1}" in class "{2}". Setting query lock level to LockModeType.RE
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.