cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r471970 - /incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/DataContextFaults.java
Date Tue, 07 Nov 2006 02:30:47 GMT
Author: aadamchik
Date: Mon Nov  6 18:30:47 2006
New Revision: 471970

URL: http://svn.apache.org/viewvc?view=rev&rev=471970
Log:
CAY-701: property" package refactoring
(being paranoid about object state when resolving a fault)

Modified:
    incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/DataContextFaults.java

Modified: incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/DataContextFaults.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/DataContextFaults.java?view=diff&rev=471970&r1=471969&r2=471970
==============================================================================
--- incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/DataContextFaults.java
(original)
+++ incubator/cayenne/main/trunk/core/cayenne-jdk1.4/src/main/java/org/apache/cayenne/access/DataContextFaults.java
Mon Nov  6 18:30:47 2006
@@ -78,10 +78,15 @@
          * Resolves this fault to a DataObject.
          */
         public Object resolveFault(Persistent sourceObject, String relationshipName) {
+            int state = sourceObject.getPersistenceState();
+            if(state == PersistenceState.NEW) {
+                return null;
+            }
+            
             Object target = doResolveFault(sourceObject, relationshipName);
 
             // must update the diff for the object
-            int state = sourceObject.getPersistenceState();
+            
             ObjectContext context = sourceObject.getObjectContext();
             if ((state == PersistenceState.MODIFIED || state == PersistenceState.DELETED)
                     && context instanceof DataContext) {



Mime
View raw message