openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r1151637 - in /openjpa/branches/2.1.x: openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Date Wed, 27 Jul 2011 21:32:35 GMT
Author: mikedd
Date: Wed Jul 27 21:32:34 2011
New Revision: 1151637

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

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

Modified: openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java?rev=1151637&r1=1151636&r2=1151637&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
(original)
+++ openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/conf/Compatibility.java
Wed Jul 27 21:32:34 2011
@@ -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;
+    }
 }
+

Modified: openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java?rev=1151637&r1=1151636&r2=1151637&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/XMLPersistenceMetaDataParser.java
Wed Jul 27 21:32:34 2011
@@ -856,9 +856,12 @@ public class XMLPersistenceMetaDataParse
         }
 
         if (_mode == MODE_QUERY) {
-            if (_parser != null)
-                _parser.parse(_cls);
-            return true;
+            if(_conf.getCompatibilityInstance().getParseAnnotationsForQueryMode()) { 
+                if (_parser != null) {
+                    _parser.parse(_cls); 
+                }
+                return true;
+            }
         }
 
         Log log = getLog();



Mime
View raw message