hot fix for many-to-many relationships revers engineering

Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/3b619d4e
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/3b619d4e
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/3b619d4e

Branch: refs/heads/master
Commit: 3b619d4e03e1c788d49f79c9711d81f3ec1a85ba
Parents: 01d29ec
Author: alexkolonitsky <alex.kolonit...@gmail.com>
Authored: Mon Jan 19 17:11:27 2015 +0300
Committer: alexkolonitsky <alex.kolonit...@gmail.com>
Committed: Mon Jan 19 17:11:27 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/cayenne/map/DbRelationship.java | 8 +++++++-
 docs/doc/src/main/resources/RELEASE-NOTES.txt                | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/3b619d4e/cayenne-server/src/main/java/org/apache/cayenne/map/DbRelationship.java
----------------------------------------------------------------------
diff --git 
a/cayenne-server/src/main/java/org/apache/cayenne/map/DbRelationship.java 
b/cayenne-server/src/main/java/org/apache/cayenne/map/DbRelationship.java
index cee22e8..d02fe14 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/map/DbRelationship.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/map/DbRelationship.java
@@ -540,7 +540,7 @@ public class DbRelationship extends Relationship implements 
ConfigurationNode {
         StringBuilder res = new StringBuilder("Db Relationship : ");
         res.append(toMany ? "toMany" : "toOne ");
 
-        String sourceEntityName = getSourceEntity().getName();
+        String sourceEntityName = getSourceEntityName();
         for (DbJoin join : joins) {
             res.append(" 
(").append(sourceEntityName).append(".").append(join.getSourceName()).append(", 
")
                     
.append(targetEntityName).append(".").append(join.getTargetName()).append(")");
@@ -548,4 +548,10 @@ public class DbRelationship extends Relationship 
implements ConfigurationNode {
         return res.toString();
     }
 
+    public String getSourceEntityName() {
+        if (this.sourceEntity == null) {
+            return null;
+        }
+        return this.sourceEntity.name;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3b619d4e/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/RELEASE-NOTES.txt 
b/docs/doc/src/main/resources/RELEASE-NOTES.txt
index 8100bc8..f1f3a56 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -14,6 +14,7 @@ Date:
 ----------------------------------
 Changes/New Features:
 
+CAY-1984 cdbimport doesn't flatten many to many relationships
 CAY-1826 Merge Entity Attributes and Relationships tabs together with one 
toolbar.
 CAY-1839 Allow to link DataMaps to DataNodes from DataNode editor.
 CAY-1841 Filters for Left-hand project navigator

Reply via email to