openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r930957 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/meta/ openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/ openjpa-p...
Date Mon, 05 Apr 2010 20:48:54 GMT
Author: curtisr7
Date: Mon Apr  5 20:48:54 2010
New Revision: 930957

URL: http://svn.apache.org/viewvc?rev=930957&view=rev
Log:
OPENJPA-1604: Backing out the two previous commits while investigating a couple test failures.

Removed:
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestNamedQueryLockMode.java
Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
    openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.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/EntityManagerImpl.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
    openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties

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=930957&r1=930956&r2=930957&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
Mon Apr  5 20:48:54 2010
@@ -58,8 +58,7 @@ public class QueryMetaData
     private String _resultSetMappingName;
     private int _lineNum;  
     private int _colNum;  
-    private int _lockMode;
-    
+
     /**
      * Construct with the given name.
      */
@@ -157,14 +156,6 @@ public class QueryMetaData
     public void setQueryString(String query) {
         _query = query;
     }
-    
-    public void setLockMode(int mode) {
-        _lockMode = mode;
-    }
-    
-    public int getLockMode() {
-        return _lockMode;
-    }
 
     /**
      * Query hints.
@@ -218,7 +209,6 @@ public class QueryMetaData
             query.setReadOnly(_readOnly.booleanValue());
         if (_resultSetMappingName != null)
             query.setResultMapping(null, _resultSetMappingName);
-        query.getFetchConfiguration().setReadLockLevel(_lockMode);
     }
 
     /**

Modified: openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java?rev=930957&r1=930956&r2=930957&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
(original)
+++ openjpa/trunk/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/LockEmployee.java
Mon Apr  5 20:48:54 2010
@@ -25,22 +25,13 @@ import java.io.ObjectOutput;
 
 import javax.persistence.Entity;
 import javax.persistence.Id;
-import javax.persistence.LockModeType;
-import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.Version;
 
-
-@NamedQueries({
-    @NamedQuery(name="findEmployeeById",
-                query="SELECT c FROM LockEmployee c WHERE c.id = :id"),
-    @NamedQuery(name="findEmployeeByIdWithLock",
-                query="SELECT c FROM LockEmployee c WHERE c.id = :id",
-                lockMode=LockModeType.PESSIMISTIC_READ),
-    @NamedQuery(name="findEmployeeByIdWithNoLock",
-            query="SELECT c FROM LockEmployee c WHERE c.id = :id",
-            lockMode=LockModeType.NONE)
-    })
+@NamedQuery(
+        name="findEmployeeById"
+        , query="SELECT c FROM LockEmployee c WHERE c.id = :id"
+        )
 
 @Entity
 public class LockEmployee implements Externalizable {

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=930957&r1=930956&r2=930957&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
Mon Apr  5 20:48:54 2010
@@ -94,7 +94,6 @@ 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;
@@ -1776,10 +1775,11 @@ 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/EntityManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java?rev=930957&r1=930956&r2=930957&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java
Mon Apr  5 20:48:54 2010
@@ -85,7 +85,6 @@ import org.apache.openjpa.persistence.va
 import org.apache.openjpa.util.ExceptionInfo;
 import org.apache.openjpa.util.Exceptions;
 import org.apache.openjpa.util.ImplHelper;
-import org.apache.openjpa.util.NoTransactionException;
 import org.apache.openjpa.util.RuntimeExceptionTranslator;
 import org.apache.openjpa.util.UserException;
 
@@ -1024,13 +1023,7 @@ public class EntityManagerImpl
             if (pq != null) {
                 pq.setInto(del);
             } else {
-                try {
-                    meta.setInto(del);
-                } catch (NoTransactionException e) {
-                    throw new TransactionRequiredException(_loc.get("named-query-no-txn",
name, 
-                           meta.getDefiningType(), MixedLockLevelsHelper.fromLockLevel(meta.getLockMode())),

-                           new Throwable[]{e}, name, false);
-                }
+                meta.setInto(del);
                 del.compile();
             }
             

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=930957&r1=930956&r2=930957&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
Mon Apr  5 20:48:54 2010
@@ -50,7 +50,6 @@ 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;
@@ -509,7 +508,7 @@ public class QueryImpl<X> implements Ope
             return false;
         }
         FetchConfiguration fetch = _query.getFetchConfiguration();
-        if (fetch.getReadLockLevel() != LockLevels.LOCK_NONE)
+        if (fetch.getReadLockLevel() != 0)
             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=930957&r1=930956&r2=930957&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
Mon Apr  5 20:48:54 2010
@@ -1674,7 +1674,7 @@ public class XMLPersistenceMetaDataParse
         meta.setLanguage(JPQLParser.LANG_JPQL);
         String lockModeStr = attrs.getValue("lock-mode");
         if (lockModeStr != null) {
-            meta.setLockMode(MixedLockLevelsHelper.toLockLevel(LockModeType.valueOf(lockModeStr)));
+            meta.addHint("openjpa.FetchPlan.ReadLockMode", LockModeType.valueOf(lockModeStr));
         }
         Locator locator = getLocation().getLocator();
         if (locator != null) {

Modified: openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties?rev=930957&r1=930956&r2=930957&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/resources/org/apache/openjpa/persistence/localizer.properties
Mon Apr  5 20:48:54 2010
@@ -229,7 +229,4 @@ create-emf-depend-error: Failed to creat
 invalid-version-attribute: Persistence version attribute value "{0}" is not valid.  Using
version "{1}" by default.
 not-jpql-or-criteria-query: Query is neither a JPQL SELECT nor a Criteria API query.
 cache-retrieve-override: The setting of CacheRetrieveMode.USE is ignored and set to BYPASS
for refresh operation.  
-null-detach: Can not detach null entity
-named-query-no-txn: Named query "{0}" declared in "{1}" specifies "{2}" lock mode and hence
must be \
-	created and executed within an active transaction.
-	
\ No newline at end of file
+null-detach: Can not detach null entity
\ No newline at end of file



Mime
View raw message