You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2019/10/08 07:49:09 UTC
[cayenne] 02/03: CAY-2627 Modeler: ObjRelationship creation dialog
ignores delete rule
This is an automated email from the ASF dual-hosted git repository.
ntimofeev pushed a commit to branch STABLE-4.0
in repository https://gitbox.apache.org/repos/asf/cayenne.git
commit 309d84413077bb44c3ecdc7c91d5d2b721db261a
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Mon Oct 7 14:26:46 2019 +0300
CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
(cherry picked from commit d8680a4d7ee5d09f7cbcabba5e3a9cd0f90d6d09)
---
RELEASE-NOTES.txt | 1 +
.../apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index eec3c49..6c40987 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -29,6 +29,7 @@ CAY-2584 Crypto: can't use ColumnSelect with encrypted columns
CAY-2586 Char can't be materialized to EnumType in some cases
CAY-2616 Modeler: Wrong handling of path with spaces
CAY-2624 SelectQuery "having" qualifier is not considered when calculating cache key
+CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
----------------------------------
Release: 4.0.1
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
index c9b1cb7..da0e579 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/dialog/objentity/ObjRelationshipInfo.java
@@ -554,6 +554,7 @@ public class ObjRelationshipInfo extends CayenneController implements TreeSelect
boolean hasChanges = false;
boolean oldToMany = relationship.isToMany();
+ boolean oldPathNotEmpty = !relationship.getDbRelationships().isEmpty();
String relationshipName = getRelationshipName();
if (!Util.nullSafeEquals(relationship.getName(), relationshipName)) {
@@ -620,7 +621,7 @@ public class ObjRelationshipInfo extends CayenneController implements TreeSelect
* As of CAY-436 here we check if to-many property has changed during
* the editing, and if so, delete rule must be reset to default value
*/
- if (hasChanges && relationship.isToMany() != oldToMany) {
+ if (oldPathNotEmpty && hasChanges && relationship.isToMany() != oldToMany) {
DeleteRuleUpdater.updateObjRelationship(relationship);
}