openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r923755 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-persistence/src/main/java/org/apache/openjpa/persistence/
Date Tue, 16 Mar 2010 14:30:53 GMT
Author: ppoddar
Date: Tue Mar 16 14:30:53 2010
New Revision: 923755

URL: http://svn.apache.org/viewvc?rev=923755&view=rev
Log:
OPENJPA-1578: Set CacheMode properties properly

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerImpl.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=923755&r1=923754&r2=923755&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Tue Mar 16 14:30:53 2010
@@ -78,6 +78,7 @@ import org.apache.openjpa.meta.FieldMeta
 import org.apache.openjpa.meta.JavaTypes;
 import org.apache.openjpa.meta.ValueStrategies;
 import org.apache.openjpa.util.ApplicationIds;
+import org.apache.openjpa.util.Exceptions;
 import org.apache.openjpa.util.Id;
 import org.apache.openjpa.util.ImplHelper;
 import org.apache.openjpa.util.InvalidStateException;
@@ -328,7 +329,8 @@ public class JDBCStoreManager 
         } catch (ClassNotFoundException cnfe) {
             throw new UserException(cnfe);
         } catch (SQLException se) {
-            throw SQLExceptions.getStore(se, _dict, fetch.getReadLockLevel());
+            throw SQLExceptions.getStore(se, Exceptions.toString(sm.getPersistenceCapable()),

+                    _dict, fetch.getReadLockLevel());
         }
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java?rev=923755&r1=923754&r2=923755&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/FetchConfigurationImpl.java
Tue Mar 16 14:30:53 2010
@@ -228,6 +228,8 @@ public class FetchConfigurationImpl
         addFetchGroups(fetch.getFetchGroups());
         clearFields();
         copyHints(fetch);
+        setCacheRetrieveMode(fetch.getCacheRetrieveMode());
+        setCacheStoreMode(fetch.getCacheStoreMode());
         addFields(fetch.getFields());
 
         // don't use setters because require active transaction

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=923755&r1=923754&r2=923755&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
Tue Mar 16 14:30:53 2010
@@ -482,6 +482,7 @@ public class EntityManagerImpl
     @SuppressWarnings("unchecked")
     public <T> T find(Class<T> cls, Object oid, LockModeType mode, Map<String,
Object> properties) {
         assertNotCloseInvoked();
+        configureCurrentCacheModes(getFetchPlan(), properties);
         configureCurrentFetchPlan(pushFetchPlan(), properties, mode, true);
         try {
             oid = _broker.newObjectId(cls, oid);
@@ -1174,7 +1175,7 @@ public class EntityManagerImpl
         assertNotCloseInvoked();
         assertValidAttchedEntity("lock", entity);
         _broker.assertActiveTransaction();
-
+        configureCurrentCacheModes(getFetchPlan(), properties);
         configureCurrentFetchPlan(pushFetchPlan(), properties, mode, false);
         try {
             _broker.lock(entity, MixedLockLevelsHelper.toLockLevel(mode),
@@ -1663,7 +1664,6 @@ public class EntityManagerImpl
     private void configureCurrentFetchPlan(FetchPlan fetch, Map<String, Object> properties,

             LockModeType lock, boolean requiresTxn) {
         // handle properties in map first
-        configureCurrentCacheModes(fetch, properties);
         if (properties != null) {
             for (Map.Entry<String, Object> entry : properties.entrySet())
                 fetch.setHint(entry.getKey(), entry.getValue());
@@ -1680,6 +1680,16 @@ public class EntityManagerImpl
         }
     }
     
+    /**
+     * Populate the fetch configuration with specified cache mode properties.
+     * The cache mode properties modify the fetch configuration and remove those
+     * properties. This method should be called <em>before</em> the fetch configuration
of the current 
+     * context has been pushed.
+     * @param fetch the fetch configuration of the current context. Not the 
+     * new configuration pushed (and later popped) during a single operation.
+     * 
+     * @param properties
+     */
     private void configureCurrentCacheModes(FetchPlan fetch, Map<String, Object> properties)
{
         if (properties == null)
             return;



Mime
View raw message