openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r1133900 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Date Thu, 09 Jun 2011 14:49:11 GMT
Author: mikedd
Date: Thu Jun  9 14:49:11 2011
New Revision: 1133900

URL: http://svn.apache.org/viewvc?rev=1133900&view=rev
Log:
OPENJPA-2011: Optionally prevent reparsing annotations in in query mode. 

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java?rev=1133900&r1=1133899&r2=1133900&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
Thu Jun  9 14:49:11 2011
@@ -68,6 +68,7 @@ public class Compatibility {
     private boolean _ignoreDetachedStateFieldForProxySerialization = false;
     private boolean _checkDatabaseForCascadePersistToDetachedEntity = false;
     private boolean _overrideContextClassloader = true;
+    private boolean _parseAnnotationsForQueryMode = true;
     
     /**
      * Whether to require exact identity value types when creating object
@@ -577,4 +578,25 @@ public class Compatibility {
     public void setOverrideContextClassloader(boolean overrideContextClassloader) {
         _overrideContextClassloader = overrideContextClassloader;
     }
+    
+    /**
+     * 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;
+    }
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=1133900&r1=1133899&r2=1133900&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Thu Jun  9 14:49:11 2011
@@ -864,8 +864,11 @@ public class XMLPersistenceMetaDataParse
         }
 
         if (_mode == MODE_QUERY) {
-            if (_parser != null)
-                _parser.parse(_cls);
+            if(_conf.getCompatibilityInstance().getParseAnnotationsForQueryMode()){ 
+                if (_parser != null) {
+                    _parser.parse(_cls);
+                }
+            }
             return true;
         }
 



Mime
View raw message