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/07 11:27:08 UTC

[cayenne] branch master updated: 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 master
in repository https://gitbox.apache.org/repos/asf/cayenne.git


The following commit(s) were added to refs/heads/master by this push:
     new d8680a4  CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
d8680a4 is described below

commit d8680a4d7ee5d09f7cbcabba5e3a9cd0f90d6d09
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Mon Oct 7 14:26:46 2019 +0300

    CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
---
 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 bfd0145..fd63da7 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -99,6 +99,7 @@ CAY-2616 Modeler: Wrong handling of path with spaces
 CAY-2618 Unstable property ordering in generated classes
 CAY-2619 "to-dep PK" related dbimport delta confuses the Modeler
 CAY-2624 SelectQuery "having" qualifier is not considered when calculating cache key
+CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
 
 ----------------------------------
 Release: 4.1.B1
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 d936ed6..e173c21 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
@@ -545,6 +545,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)) {
@@ -611,7 +612,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);
         }