Author: andrey
Date: Mon Nov  2 05:57:01 2009
New Revision: 831800

URL: http://svn.apache.org/viewvc?rev=831800&view=rev
Log:
fixing db relationship delete issue

Modified:
    
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
    
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java

Modified: 
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java?rev=831800&r1=831799&r2=831800&view=diff
==============================================================================
--- 
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
 (original)
+++ 
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
 Mon Nov  2 05:57:01 2009
@@ -541,7 +541,7 @@
      */
     public void setDbRelationshipPath(String relationshipPath) {
         if (!Util.nullSafeEquals(getDbRelationshipPath(), relationshipPath)) {
-            refreshFromPath(relationshipPath);
+            refreshFromPath(relationshipPath, false);
         }
     }
     
@@ -560,7 +560,7 @@
      */
     synchronized void refreshFromDeferredPath() {
         if (deferredPath != null) {
-            refreshFromPath(deferredPath);
+            refreshFromPath(deferredPath, true);
             deferredPath = null;
         }
     }
@@ -608,7 +608,7 @@
     /**
      * Rebuild a list of relationships if String relationshipPath has changed.
      */
-    final void refreshFromPath(String dbRelationshipPath) {
+    final void refreshFromPath(String dbRelationshipPath, boolean 
stripInvalid) {
         synchronized (this) {
 
             // remove existing relationships
@@ -634,7 +634,9 @@
                     }
                 }
                 catch (ExpressionException ex) {
-                    throw ex;
+                       if (!stripInvalid) {
+                               throw ex;
+                       }
                 }
             }
 

Modified: 
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
URL: 
http://svn.apache.org/viewvc/cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java?rev=831800&r1=831799&r2=831800&view=diff
==============================================================================
--- 
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
 (original)
+++ 
cayenne/main/branches/STABLE-3.0/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
 Mon Nov  2 05:57:01 2009
@@ -147,7 +147,7 @@
         // attempt to resolve must fail - relationship is outside of context,
         // plus the path is random
         try {
-            relationship.refreshFromPath("dummy.path");
+            relationship.refreshFromPath("dummy.path", false);
             fail("refresh over a dummy path should have failed.");
         }
         catch (ExpressionException ex) {
@@ -171,7 +171,7 @@
         dbEntity1.addRelationship(dummyR);
         dbEntity2.addRelationship(pathR);
 
-        relationship.refreshFromPath("dummy.path");
+        relationship.refreshFromPath("dummy.path", false);
 
         List<DbRelationship> resolvedPath = relationship.getDbRelationships();
         assertEquals(2, resolvedPath.size());


Reply via email to