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:07 UTC

[cayenne] branch STABLE-4.0 updated (cc6d10c -> 3264658)

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

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


    from cc6d10c  CAY-2624 SelectQuery "having" qualifier is not considered when calculating cache key
     new e5d7f81  Fix license check
     new 309d844  CAY-2627 Modeler: ObjRelationship creation dialog ignores delete rule
     new 3264658  CAY-2628 dbimport: unable to add several relationships to existing entity

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                                        |  2 ++
 .../cayenne/dbsync/merge/DbRelationshipDictionary.java   |  4 ++--
 .../test/java/org/apache/cayenne/ManyToManyJoinIT.java   |  2 +-
 .../dbimport/testImportNewRelationship.map.xml-result    | 16 ++++++++++++++++
 .../cayenne/tools/dbimport/testImportNewRelationship.sql | 10 +++++++++-
 .../modeler/dialog/objentity/ObjRelationshipInfo.java    |  3 ++-
 6 files changed, 32 insertions(+), 5 deletions(-)


[cayenne] 02/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.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);
         }
 


[cayenne] 01/03: Fix license check

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.0
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit e5d7f81627dffac13497889a1e973f4d5581be29
Author: Nikita Timofeev <st...@gmail.com>
AuthorDate: Tue Oct 8 10:29:42 2019 +0300

    Fix license check
---
 cayenne-server/src/test/java/org/apache/cayenne/ManyToManyJoinIT.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cayenne-server/src/test/java/org/apache/cayenne/ManyToManyJoinIT.java b/cayenne-server/src/test/java/org/apache/cayenne/ManyToManyJoinIT.java
index b8b25e8..81f5dcc 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/ManyToManyJoinIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/ManyToManyJoinIT.java
@@ -7,7 +7,7 @@
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
  *
- *    https://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an


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

commit 3264658866afb34f746e9cb1889d87e92ce9e4c1
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 +
 .../cayenne/dbsync/merge/DbRelationshipDictionary.java   |  4 ++--
 .../dbimport/testImportNewRelationship.map.xml-result    | 16 ++++++++++++++++
 .../cayenne/tools/dbimport/testImportNewRelationship.sql | 10 +++++++++-
 4 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 6c40987..cf57557 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -30,6 +30,7 @@ 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
+CAY-2628 dbimport: unable to add several relationships to existing entity
 
 ----------------------------------
 Release: 4.0.1
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 4d5d74c..1298c59 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
@@ -72,9 +72,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 5daeef7..04198bd 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
@@ -31,18 +31,34 @@
         <db-attribute name="T2_NAME" type="VARCHAR" length="45"/>
         <db-attribute name="TABLE1_ID" type="INTEGER" isMandatory="true" length="10"/>
      </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>
+    <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="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" toMany="false">
         <db-attribute-pair source="TABLE1_ID" target="ID"/>
      </db-relationship>
+    <db-relationship name="table1" source="TABLE3" target="TABLE1" toMany="false">
+        <db-attribute-pair source="TABLE1_ID" target="ID"/>
+    </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