cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [1/4] cayenne git commit: CAY-2291 ObjEntity > ObjRelationship Inspector > New DbRelationship: Impossible to create 1:1 relationship
Date Thu, 11 May 2017 12:49:16 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master e0fe30731 -> 045c96223


CAY-2291 ObjEntity > ObjRelationship Inspector > New DbRelationship: Impossible to create
1:1 relationship


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

Branch: refs/heads/master
Commit: a1fccd3d7b88d7517a7df13eb67bfa8c5a65ac71
Parents: 652004e
Author: Anton Dreka <drekoas@gmail.com>
Authored: Wed May 10 17:44:20 2017 +0300
Committer: Anton Dreka <drekoas@gmail.com>
Committed: Wed May 10 17:44:20 2017 +0300

----------------------------------------------------------------------
 .../apache/cayenne/dbsync/naming/DefaultObjectNameGenerator.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/a1fccd3d/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/naming/DefaultObjectNameGenerator.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/naming/DefaultObjectNameGenerator.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/naming/DefaultObjectNameGenerator.java
index 4559ab6..f266db8 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/naming/DefaultObjectNameGenerator.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/naming/DefaultObjectNameGenerator.java
@@ -103,7 +103,9 @@ public class DefaultObjectNameGenerator implements ObjectNameGenerator
{
 
         List<DbJoin> joins = first.getJoins();
         if (joins.isEmpty()) {
-            throw new IllegalArgumentException("No joins for relationship. Can't generate
a name");
+            // In case, when uses EditRelationship button, relationship doesn't exist =>
it doesn't have joins
+            // and just return targetName
+            return stemmed(last.getTargetEntityName());
         }
 
         DbJoin join1 = joins.get(0);


Mime
View raw message