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 08:20:56 UTC

[cayenne] branch STABLE-4.1 updated (68e620e -> 40d0d18)

This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a change to branch STABLE-4.1
in repository https://gitbox.apache.org/repos/asf/cayenne.git.


    from 68e620e  placing CAY-2624 bugfix in the right release notes section
     new 066ac83  CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
     new 109d6c3  CAY-2628 dbimport: unable to add several relationships to existing entity
     new 40d0d18  Add next version

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 RELEASE-NOTES.txt                                  | 10 ++++
 .../dbsync/merge/DbRelationshipDictionary.java     |  4 +-
 .../testImportNewRelationship.map.xml-result       | 58 ++++++++++++++--------
 .../tools/dbimport/testImportNewRelationship.sql   | 10 +++-
 .../dialog/objentity/ObjRelationshipInfo.java      |  3 +-
 5 files changed, 60 insertions(+), 25 deletions(-)


[cayenne] 02/03: CAY-2628 dbimport: unable to add several relationships to existing entity

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch STABLE-4.1
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 109d6c365e794d14f73d23ed6e97ea53e86131e7
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Mon Oct 7 17:59:51 2019 +0300

    CAY-2628 dbimport: unable to add several relationships to existing entity
    
    (cherry picked from commit 9a6ab370ab8dfe11c94723c79b05c6bd6ab35bb7)
---
 RELEASE-NOTES.txt                                  |  1 +
 .../dbsync/merge/DbRelationshipDictionary.java     |  4 +-
 .../testImportNewRelationship.map.xml-result       | 58 ++++++++++++++--------
 .../tools/dbimport/testImportNewRelationship.sql   | 10 +++-
 4 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index dc73327..5433ae9 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -44,6 +44,7 @@ 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
+CAY-2628 dbimport: unable to add several relationships to existing entity
 
 ----------------------------------
 Release: 4.1.B2
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DbRelationshipDictionary.java b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DbRelationshipDictionary.java
index ae014d2..df66d03 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DbRelationshipDictionary.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/DbRelationshipDictionary.java
@@ -100,9 +100,9 @@ class DbRelationshipDictionary extends MergerDictionary<DbRelationship> {
             TreeSet<String> joins = new TreeSet<>();
             for(DbJoin join : relationship.getJoins()) {
                 joins.add(
-                        (join.getSource() == null ? "~" : join.getSource().getName()) + "." + join.getSourceName()
+                        relationship.getSourceEntityName() + "." + join.getSourceName()
                         + ">" +
-                        (join.getTarget() == null ? "~" : join.getTarget().getName()) + "." + join.getTargetName()
+                        relationship.getTargetEntityName() + "." + join.getTargetName()
                 );
             }
             joinSignature = joins.toArray(new String[0]);
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.map.xml-result
index 23e2f6f..240054c 100644
--- a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.map.xml-result
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.map.xml-result
@@ -18,31 +18,47 @@
   ~  under the License.
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
 <data-map xmlns="http://cayenne.apache.org/schema/10/modelMap"
-	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	 xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd"
-	 project-version="10">
-	 <property name="defaultSchema" value="SCHEMA_01"/>
-	 <db-entity name="TABLE1" schema="SCHEMA_01">
-    		<db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
-    		<db-attribute name="T1_NAME" type="VARCHAR" length="45"/>
-     </db-entity>
-     <db-entity name="TABLE2" schema="SCHEMA_01">
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://cayenne.apache.org/schema/10/modelMap http://cayenne.apache.org/schema/10/modelMap.xsd"
+          project-version="10">
+    <property name="defaultSchema" value="SCHEMA_01"/>
+    <db-entity name="TABLE1" schema="SCHEMA_01">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+        <db-attribute name="T1_NAME" type="VARCHAR" length="45"/>
+    </db-entity>
+    <db-entity name="TABLE2" schema="SCHEMA_01">
         <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
         <db-attribute name="T2_NAME" type="VARCHAR" length="45"/>
         <db-attribute name="TABLE1_ID" type="INTEGER" isMandatory="true" length="10"/>
-     </db-entity>
-     <obj-entity name="Table1" className="Table1" dbEntityName="TABLE1">
-         <obj-attribute name="t1Name" type="java.lang.String" db-attribute-path="T1_NAME"/>
-     </obj-entity>
-     <obj-entity name="Table2" className="Table2" dbEntityName="TABLE2">
+    </db-entity>
+    <db-entity name="TABLE3" schema="SCHEMA_01">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+        <db-attribute name="T3_NAME" type="VARCHAR" length="45"/>
+        <db-attribute name="TABLE1_ID" type="INTEGER" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="Table1" className="Table1" dbEntityName="TABLE1">
+        <obj-attribute name="t1Name" type="java.lang.String" db-attribute-path="T1_NAME"/>
+    </obj-entity>
+    <obj-entity name="Table2" className="Table2" dbEntityName="TABLE2">
         <obj-attribute name="t2Name" type="java.lang.String" db-attribute-path="T2_NAME"/>
-     </obj-entity>
-     <db-relationship name="table2s" source="TABLE1" target="TABLE2" toMany="true">
+    </obj-entity>
+    <obj-entity name="Table3" className="Table3" dbEntityName="TABLE3">
+        <obj-attribute name="t3Name" type="java.lang.String" db-attribute-path="T3_NAME"/>
+    </obj-entity>
+    <db-relationship name="table3s" source="TABLE1" target="TABLE3" toMany="true">
         <db-attribute-pair source="ID" target="TABLE1_ID"/>
-     </db-relationship>
-     <db-relationship name="table1" source="TABLE2" target="TABLE1">
+    </db-relationship>
+    <db-relationship name="table2s" source="TABLE1" target="TABLE2" toMany="true">
+        <db-attribute-pair source="ID" target="TABLE1_ID"/>
+    </db-relationship>
+    <db-relationship name="table1" source="TABLE2" target="TABLE1">
+        <db-attribute-pair source="TABLE1_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="table1" source="TABLE3" target="TABLE1">
         <db-attribute-pair source="TABLE1_ID" target="ID"/>
-     </db-relationship>
-     <obj-relationship name="table2s" source="Table1" target="Table2" deleteRule="Deny" db-relationship-path="table2s"/>
-     <obj-relationship name="table1" source="Table2" target="Table1" deleteRule="Nullify" db-relationship-path="table1"/>
+    </db-relationship>
+    <obj-relationship name="table3s" source="Table1" target="Table3" deleteRule="Deny" db-relationship-path="table3s"/>
+    <obj-relationship name="table2s" source="Table1" target="Table2" deleteRule="Deny" db-relationship-path="table2s"/>
+    <obj-relationship name="table1" source="Table2" target="Table1" deleteRule="Nullify" db-relationship-path="table1"/>
+    <obj-relationship name="table1" source="Table3" target="Table1" deleteRule="Nullify" db-relationship-path="table1"/>
 </data-map>
\ No newline at end of file
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.sql
index 81115f9..7c667e5 100644
--- a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.sql
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewRelationship.sql
@@ -29,5 +29,13 @@ CREATE TABLE schema_01.table2 (
     t2_name VARCHAR (45),
     table1_id INTEGER  NOT NULL,
     PRIMARY KEY (id),
-    CONSTRAINT fk_address FOREIGN KEY (table1_id) REFERENCES schema_01.table1 (id)
+    CONSTRAINT fk_table2_table1_id FOREIGN KEY (table1_id) REFERENCES schema_01.table1 (id)
+);
+
+CREATE TABLE schema_01.table3 (
+    id INTEGER  NOT NULL,
+    t3_name VARCHAR (45),
+    table1_id INTEGER  NOT NULL,
+    PRIMARY KEY (id),
+    CONSTRAINT fk_table3_table1_id FOREIGN KEY (table1_id) REFERENCES schema_01.table1 (id)
 );
\ No newline at end of file


[cayenne] 01/03: CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch STABLE-4.1
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 066ac8316b9632e08cd2d39714c7d40b5a1c3f12
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 a713411..dc73327 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -43,6 +43,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.B2
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 d381f82..d1c33d0 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
@@ -517,6 +517,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)) {
@@ -583,7 +584,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);
         }
 


[cayenne] 03/03: Add next version

Posted by nt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ntimofeev pushed a commit to branch STABLE-4.1
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 40d0d187c4ab310c031122d4af0882294e36022b
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Oct 8 11:20:10 2019 +0300

    Add next version
---
 RELEASE-NOTES.txt | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 5433ae9..ac2bf6f 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -8,6 +8,16 @@ To browse individual bug reports check out project issue tracker:
 https://issues.apache.org/jira/browse/CAY
 
 ----------------------------------
+Release: 4.1.RC2
+Date:
+----------------------------------
+
+Bug Fixes:
+
+CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
+CAY-2628 dbimport: unable to add several relationships to existing entity
+
+----------------------------------
 Release: 4.1.RC1
 Date: October 3, 2019
 ----------------------------------
@@ -43,8 +53,6 @@ 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
-CAY-2628 dbimport: unable to add several relationships to existing entity
 
 ----------------------------------
 Release: 4.1.B2