cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kolonit...@apache.org
Subject [1/2] cayenne git commit: fix many-to-many relationship loading
Date Thu, 02 Apr 2015 20:22:02 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master edc8975c5 -> 3f0c7f984


fix many-to-many relationship loading


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

Branch: refs/heads/master
Commit: ca6a9b3aeccbf4635fbfcf933fb9d52e9cabf46b
Parents: cc3dba5
Author: kolonitsky <Alex.Kolonitsky@gmail.com>
Authored: Thu Apr 2 23:21:35 2015 +0300
Committer: kolonitsky <Alex.Kolonitsky@gmail.com>
Committed: Thu Apr 2 23:21:35 2015 +0300

----------------------------------------------------------------------
 .../apache/cayenne/tools/dbimport/DbImportAction.java  | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/ca6a9b3a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
----------------------------------------------------------------------
diff --git a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
index ea4c459..d604c45 100644
--- a/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
+++ b/cayenne-tools/src/main/java/org/apache/cayenne/tools/dbimport/DbImportAction.java
@@ -135,13 +135,14 @@ public class DbImportAction {
     }
 
     private void relationshipsSanity(DataMap executed) {
-        // obj relationships sanity
         for (ObjEntity objEntity : executed.getObjEntities()) {
-            for (ObjRelationship objRelationship : objEntity.getRelationships()) {
-                if (objRelationship.getSourceEntity() == null
-                        || objRelationship.getTargetEntity() == null) {
-                    logger.error("Incorrect obj relationship: " + objRelationship);
-                    objEntity.removeRelationship(objRelationship.getName());
+
+            List<ObjRelationship> rels = new LinkedList<ObjRelationship>(objEntity.getRelationships());
+            for (ObjRelationship rel : rels) {
+                if (rel.getSourceEntity() == null || rel.getTargetEntity() == null) {
+                    logger.error("Incorrect obj relationship source or target entity is null:
" + rel);
+
+                    objEntity.removeRelationship(rel.getName());
                 }
             }
         }


Mime
View raw message