mirror of
https://github.com/apache/openjpa.git
synced 2025-03-06 16:39:11 +00:00
OPENJPA-2011: Optionally prevent reparsing annotations in in query mode.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.1.x@1151637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7db9f3dc7e
commit
dddb5a0f67
@ -68,7 +68,7 @@ public class Compatibility {
|
||||
private boolean _ignoreDetachedStateFieldForProxySerialization = false;
|
||||
private boolean _convertPositionalParametersToNamed = false;
|
||||
private boolean _checkDatabaseForCascadePersistToDetachedEntity = true;
|
||||
|
||||
private boolean _parseAnnotationsForQueryMode = true;
|
||||
/**
|
||||
* Whether to require exact identity value types when creating object
|
||||
* ids from a class and value. Defaults to false.
|
||||
@ -567,4 +567,26 @@ public class Compatibility {
|
||||
public void setCheckDatabaseForCascadePersistToDetachedEntity(boolean b){
|
||||
_checkDatabaseForCascadePersistToDetachedEntity = b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a
|
||||
* query. In practice this scan is rarely needed, but the option to enable it is present for compatibility with
|
||||
* prior releases.
|
||||
* @since 2.0.2
|
||||
* @return true if the annotations should be re-parsed when resolving MetaData in MODE_QUERY.
|
||||
*/
|
||||
public boolean getParseAnnotationsForQueryMode() {
|
||||
return _parseAnnotationsForQueryMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether OpenJPA will scan every persistent class in an XML mapping file for annotations prior to executing a
|
||||
* query. In practice this scan is rarely needed, but the option to enable it is present for compatibility with
|
||||
* prior releases.
|
||||
* @since 2.0.2
|
||||
*/
|
||||
public void setParseAnnotationsForQueryMode(boolean parseAnnotationsForQueryMode) {
|
||||
_parseAnnotationsForQueryMode = parseAnnotationsForQueryMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -856,10 +856,13 @@ public class XMLPersistenceMetaDataParser
|
||||
}
|
||||
|
||||
if (_mode == MODE_QUERY) {
|
||||
if (_parser != null)
|
||||
if(_conf.getCompatibilityInstance().getParseAnnotationsForQueryMode()) {
|
||||
if (_parser != null) {
|
||||
_parser.parse(_cls);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Log log = getLog();
|
||||
if (log.isTraceEnabled())
|
||||
|
Loading…
x
Reference in New Issue
Block a user