openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r1307217 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel: ENonTransState.java PNonTransState.java StateManagerImpl.java TCleanState.java
Date Fri, 30 Mar 2012 02:02:50 GMT
Author: kwsutter
Date: Fri Mar 30 02:02:50 2012
New Revision: 1307217

URL: http://svn.apache.org/viewvc?rev=1307217&view=rev
Log:
OPENJPA-2167.  Only reload the proxy fields if the field is loaded and dirty.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java?rev=1307217&r1=1307216&r2=1307217&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ENonTransState.java
Fri Mar 30 02:02:50 2012
@@ -31,11 +31,11 @@ class ENonTransState
     extends PCState {
 
     void initialize(StateManagerImpl context) {
-        context.setDirty(false);
-        context.clearSavedFields();
-
         // spec says all proxies to second class objects should be reset
         context.proxyFields(true, true);
+
+        context.setDirty(false);
+        context.clearSavedFields();
     }
 
     PCState delete(StateManagerImpl context) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java?rev=1307217&r1=1307216&r2=1307217&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/PNonTransState.java
Fri Mar 30 02:02:50 2012
@@ -38,11 +38,11 @@ class PNonTransState
         (PNonTransState.class);
 
     void initialize(StateManagerImpl context) {
-        context.setDirty(false);
-        context.clearSavedFields();
-
         // spec says all proxies to second class objects should be reset
         context.proxyFields(true, false);
+
+        context.setDirty(false);
+        context.clearSavedFields();
     }
 
     PCState delete(StateManagerImpl context) {

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?rev=1307217&r1=1307216&r2=1307217&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
Fri Mar 30 02:02:50 2012
@@ -2967,7 +2967,8 @@ public class StateManagerImpl
         try {
             for (FieldMetaData fmd : _meta.getProxyFields()) {
                 int index = fmd.getIndex();
-                if (_loaded.get(index)) {
+                // only reload if dirty
+                if (_loaded.get(index) && _dirty.get(index)) {
                     provideField(_pc, _single, index);
                     if (_single.proxy(reset, replaceNull)) {
                         replaceField(_pc, _single, index);

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java?rev=1307217&r1=1307216&r2=1307217&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/TCleanState.java
Fri Mar 30 02:02:50 2012
@@ -31,13 +31,13 @@ class TCleanState
     extends PCState {
 
     void initialize(StateManagerImpl context) {
-        context.clearSavedFields();
-        context.setLoaded(true);
-        context.setDirty(false);
-
         // need to replace the second class objects with proxies that
         // listen for dirtying so we can track changes to these objects
         context.proxyFields(true, false);
+
+        context.clearSavedFields();
+        context.setLoaded(true);
+        context.setDirty(false);
     }
 
     PCState persist(StateManagerImpl context) {



Mime
View raw message