openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1140902 - in /openjpa/branches/2.0.x: openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Date Tue, 28 Jun 2011 23:22:20 GMT
Author: hthomann
Date: Tue Jun 28 23:22:20 2011
New Revision: 1140902

URL: http://svn.apache.org/viewvc?rev=1140902&view=rev
Log:
OPENJPA-2011: Optionally prevent reparsing annotations in query mode - merged Mike's changes
from trunk

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

Modified: openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java?rev=1140902&r1=1140901&r2=1140902&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
(original)
+++ openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
Tue Jun 28 23:22:20 2011
@@ -67,6 +67,7 @@ public class Compatibility {
     private boolean _reorderMetaDataResolution = true;
     private boolean _reloadOnDetach = false;
     private boolean _ignoreDetachedStateFieldForProxySerialization = false;
+    private boolean _parseAnnotationsForQueryMode = true;
     
     /**
      * Whether to require exact identity value types when creating object
@@ -556,4 +557,25 @@ public class Compatibility {
     public void setReloadOnDetach(boolean reloadOnDetach) {
         _reloadOnDetach = reloadOnDetach;
     }       
+
+    /**
+     * 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/branches/2.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=1140902&r1=1140901&r2=1140902&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
(original)
+++ openjpa/branches/2.0.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Tue Jun 28 23:22:20 2011
@@ -855,8 +855,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