Author: andrey
Date: Mon Nov 2 06:44:58 2009
New Revision: 831804
URL: http://svn.apache.org/viewvc?rev=831804&view=rev
Log:
fixing db relationship delete issue
Modified:
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
Modified:
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
URL:
http://svn.apache.org/viewvc/cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java?rev=831804&r1=831803&r2=831804&view=diff
==============================================================================
---
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
(original)
+++
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjRelationship.java
Mon Nov 2 06:44:58 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/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
URL:
http://svn.apache.org/viewvc/cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java?rev=831804&r1=831803&r2=831804&view=diff
==============================================================================
---
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
(original)
+++
cayenne/main/tags/3.0B1/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
Mon Nov 2 06:44:58 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());