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 cdb import relationship loading
Date Mon, 09 Feb 2015 11:35:47 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 4357557dd -> 667331fce


fix cdb import relationship loading


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

Branch: refs/heads/master
Commit: 660dad38c15ea24eeea0337876f59a2e08b223a8
Parents: 4357557
Author: kolonitsky <Alex.Kolonitsky@gmail.com>
Authored: Wed Jan 28 12:59:48 2015 +0300
Committer: kolonitsky <Alex.Kolonitsky@gmail.com>
Committed: Wed Jan 28 12:59:48 2015 +0300

----------------------------------------------------------------------
 .../src/main/java/org/apache/cayenne/merge/DbMerger.java       | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/660dad38/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java b/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
index c5b9547..e7ff3ac 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/merge/DbMerger.java
@@ -175,6 +175,12 @@ public class DbMerger {
         // TODO: support drop table. currently, too many tables are marked for drop
         for (DbEntity e : dbEntitiesToDrop) {
             tokens.add(factory.createDropTableToDb(e));
+            for (DbRelationship relationship : e.getRelationships()) {
+                DbEntity detectedEntity = findDbEntity(existing, relationship.getTargetEntityName());
+                if (detectedEntity != null) {
+                    tokens.add(factory.createDropRelationshipToDb(detectedEntity, relationship.getReverseRelationship()));
+                }
+            }
         }
 
         return tokens;


Mime
View raw message