cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abulat...@apache.org
Subject [cayenne] 01/02: CAY-2533 Modeler: Exception on validating ObjRelationship without db path
Date Wed, 06 Mar 2019 08:43:53 GMT
This is an automated email from the ASF dual-hosted git repository.

abulatski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cayenne.git

commit 45beebd838b14a3fcfce665435b1b5f6ffc2abaf
Author: Nikita Timofeev <stariy95@gmail.com>
AuthorDate: Mon Feb 11 15:01:49 2019 +0300

    CAY-2533 Modeler: Exception on validating ObjRelationship without db path
---
 RELEASE-NOTES.txt                                                   | 1 +
 .../apache/cayenne/project/validation/ObjRelationshipValidator.java | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt
index 5a63a04..1224677 100644
--- a/RELEASE-NOTES.txt
+++ b/RELEASE-NOTES.txt
@@ -83,6 +83,7 @@ CAY-2501 Modeler: DbImport ui not loading columns for MySQL connector v8.0
 CAY-2502 DataMap in DataNode tree view disappears after dbImport
 CAY-2504 Broken detection logic of NoopEventBridge in DataRowStoreFactory
 CAY-2505 EventBridge providers should be bound without scope
+CAY-2533 Modeler: Exception on validating ObjRelationship without db path
 
 ----------------------------------
 Release: 4.1.M2
diff --git a/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjRelationshipValidator.java
b/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjRelationshipValidator.java
index b898b4a..a3b7f31 100644
--- a/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjRelationshipValidator.java
+++ b/cayenne-project/src/main/java/org/apache/cayenne/project/validation/ObjRelationshipValidator.java
@@ -126,13 +126,13 @@ class ObjRelationshipValidator extends ConfigurationNodeValidator {
             }
         }
 
-        if(!relationship.isToPK()) {
+        if(!relationship.getDbRelationships().isEmpty() && !relationship.isToPK())
{
             ObjRelationship reverseRelationship = relationship.getReverseRelationship();
-            if(reverseRelationship != null && !reverseRelationship.isToPK()) {
+            if(reverseRelationship != null && !relationship.getDbRelationships().isEmpty()
&& !reverseRelationship.isToPK()) {
                 addFailure(
                         validationResult,
                         relationship,
-                        "ObjRelationship '%s' has join not to PK. Cayenne doesn't allow this
type of relationship",
+                        "ObjRelationship '%s' has join not to PK. This is not fully supported
by Cayenne.",
                         toString(relationship));
             }
         }


Mime
View raw message