openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r929971 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/
Date Thu, 01 Apr 2010 13:44:39 GMT
Author: ppoddar
Date: Thu Apr  1 13:44:38 2010
New Revision: 929971

URL: http://svn.apache.org/viewvc?rev=929971&view=rev
Log:
OPENJPA-1604: Add lock mode to QueryMetaData

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.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/meta/QueryMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java?rev=929971&r1=929970&r2=929971&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
Thu Apr  1 13:44:38 2010
@@ -58,7 +58,8 @@ public class QueryMetaData
     private String _resultSetMappingName;
     private int _lineNum;  
     private int _colNum;  
-
+    private int _lockMode;
+    
     /**
      * Construct with the given name.
      */
@@ -156,6 +157,14 @@ public class QueryMetaData
     public void setQueryString(String query) {
         _query = query;
     }
+    
+    public void setLockMode(int mode) {
+        _lockMode = mode;
+    }
+    
+    public int getLockMode() {
+        return _lockMode;
+    }
 
     /**
      * Query hints.
@@ -209,6 +218,7 @@ public class QueryMetaData
             query.setReadOnly(_readOnly.booleanValue());
         if (_resultSetMappingName != null)
             query.setResultMapping(null, _resultSetMappingName);
+        query.getFetchConfiguration().setReadLockLevel(_lockMode);
     }
 
     /**

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java?rev=929971&r1=929970&r2=929971&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/AnnotationPersistenceMetaDataParser.java
Thu Apr  1 13:44:38 2010
@@ -94,6 +94,7 @@ import org.apache.openjpa.event.BeanLife
 import org.apache.openjpa.event.LifecycleCallbacks;
 import org.apache.openjpa.event.LifecycleEvent;
 import org.apache.openjpa.event.MethodLifecycleCallbacks;
+import org.apache.openjpa.kernel.LockLevels;
 import org.apache.openjpa.kernel.QueryLanguages;
 import org.apache.openjpa.kernel.jpql.JPQLParser;
 import org.apache.openjpa.lib.conf.Configurations;
@@ -1775,11 +1776,10 @@ public class AnnotationPersistenceMetaDa
             meta = getRepository().addQueryMetaData(_cls, query.name());
             meta.setQueryString(query.query());
             meta.setLanguage(JPQLParser.LANG_JPQL);
+            meta.setLockMode(MixedLockLevelsHelper.toLockLevel(query.lockMode()));
             for (QueryHint hint : query.hints())
                 meta.addHint(hint.name(), hint.value());
-            if (query.lockMode() != null) {
-                meta.addHint("openjpa.FetchPlan.ReadLockMode", query.lockMode());
-            }
+            
             meta.setSource(getSourceFile(), (el instanceof Class) ? el : null,
                 SourceTracker.SRC_ANNOTATIONS);
             if (isMetaDataMode())

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java?rev=929971&r1=929970&r2=929971&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/QueryImpl.java
Thu Apr  1 13:44:38 2010
@@ -50,6 +50,7 @@ import org.apache.openjpa.kernel.Delegat
 import org.apache.openjpa.kernel.DelegatingResultList;
 import org.apache.openjpa.kernel.FetchConfiguration;
 import org.apache.openjpa.kernel.Filters;
+import org.apache.openjpa.kernel.LockLevels;
 import org.apache.openjpa.kernel.PreparedQuery;
 import org.apache.openjpa.kernel.PreparedQueryCache;
 import org.apache.openjpa.kernel.QueryLanguages;
@@ -508,7 +509,7 @@ public class QueryImpl<X> implements Ope
             return false;
         }
         FetchConfiguration fetch = _query.getFetchConfiguration();
-        if (fetch.getReadLockLevel() != 0)
+        if (fetch.getReadLockLevel() != LockLevels.LOCK_NONE)
             return false;
         Boolean registered = cache.register(_id, _query, fetch);
         boolean alreadyCached = (registered == null);

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=929971&r1=929970&r2=929971&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 Apr  1 13:44:38 2010
@@ -1674,7 +1674,7 @@ public class XMLPersistenceMetaDataParse
         meta.setLanguage(JPQLParser.LANG_JPQL);
         String lockModeStr = attrs.getValue("lock-mode");
         if (lockModeStr != null) {
-            meta.addHint("openjpa.FetchPlan.ReadLockMode", LockModeType.valueOf(lockModeStr));
+            meta.setLockMode(MixedLockLevelsHelper.toLockLevel(LockModeType.valueOf(lockModeStr)));
         }
         Locator locator = getLocation().getLocator();
         if (locator != null) {



Mime
View raw message