openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1455205 - in /openjpa/branches/2.2.x: openjpa-kernel/src/main/java/org/apache/openjpa/datacache/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/per...
Date Mon, 11 Mar 2013 16:03:49 GMT
Author: curtisr7
Date: Mon Mar 11 16:03:49 2013
New Revision: 1455205

URL: http://svn.apache.org/r1455205
Log:
OPENJPA-2285 : Revert previous changes to 2.2.x.

Removed:
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestDataCacheStoreLazyFk.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestJPAEmbeddableDataCache.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/entities/
Modified:
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java
    openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestStatistics.java

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java?rev=1455205&r1=1455204&r2=1455205&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java
Mon Mar 11 16:03:49 2013
@@ -49,7 +49,8 @@ import org.apache.openjpa.util.Optimisti
  * @author Patrick Linskey
  * @nojavadoc
  */
-public class DataCacheStoreManager extends DelegatingStoreManager {
+public class DataCacheStoreManager
+    extends DelegatingStoreManager {
 
     // all the state managers changed in this transaction
     private Collection<OpenJPAStateManager> _inserts = null;
@@ -437,12 +438,9 @@ public class DataCacheStoreManager exten
         DataCache cache = _mgr.selectCache(sm);
 
         boolean found = false;
-        int loadedFieldsBefore = sm.getLoaded().cardinality();
         if (cache == null || sm.isEmbedded() || bypass(fetch, StoreManager.FORCE_LOAD_NONE))
{
             found = super.load(sm, fields, fetch, lockLevel, edata);
-            int loadedFieldsAfter = sm.getLoaded().cardinality();
-            boolean changed = loadedFieldsAfter > loadedFieldsBefore;
-            updateDataCache(found, sm, fetch, changed);
+            updateDataCache(found, sm, fetch);
             return found;
         }
 
@@ -460,12 +458,10 @@ public class DataCacheStoreManager exten
 
         // load from store manager; clone the set of still-unloaded fields
         // so that if the store manager decides to modify it it won't affect us
-        found = super.load(sm,(BitSet) fields.clone() , fetch, lockLevel, edata);
+        found = super.load(sm, (BitSet) fields.clone(), fetch, lockLevel, edata);
 
-        int loadedFieldsAfter = sm.getLoaded().cardinality();
-        boolean changed = loadedFieldsAfter > loadedFieldsBefore;
         // Get new instance of cache after DB load since it may have changed
-        updateDataCache(found, sm, fetch, changed);
+        updateDataCache(found, sm, fetch);
 
         return found;
     }
@@ -477,13 +473,10 @@ public class DataCacheStoreManager exten
      * @param found whether the entity was found by the store manager
      * @param sm the state manager
      * @param fetch fetch configuration
-     * @param loadedFieldsChanged
      */
-    private void updateDataCache(boolean found, OpenJPAStateManager sm, FetchConfiguration
fetch,
-        boolean loadedFieldsChanged) {
+    private void updateDataCache(boolean found, OpenJPAStateManager sm, FetchConfiguration
fetch) {
 
-        if (!_ctx.getPopulateDataCache() || sm == null || sm.isEmbedded()
-            || fetch.getCacheStoreMode() == DataCacheStoreMode.BYPASS) {
+        if (!_ctx.getPopulateDataCache() || sm == null || fetch.getCacheStoreMode() == DataCacheStoreMode.BYPASS)
{
             return;
         }
 
@@ -493,12 +486,10 @@ public class DataCacheStoreManager exten
         }
 
         DataCachePCData data = cache.get(sm.getObjectId());
-        
-        // If loadedFieldsChanged = true, we don't care that data was already stored as we
should update it.
-        boolean alreadyCached = (data != null && !loadedFieldsChanged);
-        DataCacheStoreMode storeMode = fetch.getCacheStoreMode();
-        
-        if ((storeMode == DataCacheStoreMode.USE && !alreadyCached) || storeMode
== DataCacheStoreMode.REFRESH) {
+        boolean alreadyCached = data != null;
+
+        if ((fetch.getCacheStoreMode() == DataCacheStoreMode.USE && !alreadyCached)
||
+             fetch.getCacheStoreMode() == DataCacheStoreMode.REFRESH) {
             // If not found in the DB and the item is in the cache, and not locking remove
the item
             if (!found && data != null && !isLocking(fetch)) {
                 cache.remove(sm.getObjectId());

Modified: openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestStatistics.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestStatistics.java?rev=1455205&r1=1455204&r2=1455205&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestStatistics.java
(original)
+++ openjpa/branches/2.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestStatistics.java
Mon Mar 11 16:03:49 2013
@@ -115,9 +115,6 @@ public class TestStatistics extends Sing
         write++;
         write++;
         write++;
-        
-        write++;
-        write++;
         assertion(cls, hit,  read, write, stats);
 
         em.clear();
@@ -155,8 +152,6 @@ public class TestStatistics extends Sing
         assertEquals(1, p.getLazyList().size());
         read++;
         write++;
-        // +1 write for p which had its intermediate(fk) updated
-        write++;
         assertion(cls, hit,  read, write, stats);
         em.clear();
 



Mime
View raw message