You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by sk...@apache.org on 2016/12/19 11:47:23 UTC
[1/2] cayenne git commit: CAY-2174 Change FK attribute name cause
ObjAttribute appear after Reverse Engineering
Repository: cayenne
Updated Branches:
refs/heads/master 27138761c -> 63ce57103
CAY-2174
Change FK attribute name cause ObjAttribute appear after Reverse Engineering
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/802a5258
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/802a5258
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/802a5258
Branch: refs/heads/master
Commit: 802a5258bd5d6556fce220dfcd644064058a497e
Parents: d8b17c1
Author: Nikita Timofeev <st...@gmail.com>
Authored: Thu Dec 15 17:41:51 2016 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Thu Dec 15 17:41:51 2016 +0300
----------------------------------------------------------------------
.../merge/context/EntityMergeSupport.java | 3 ++
docs/doc/src/main/resources/RELEASE-NOTES.txt | 1 +
.../cayenne/tools/DbImporterMojoTest.java | 5 +++
.../dbimport/testFkAttributeRename-pom.xml | 46 ++++++++++++++++++++
.../dbimport/testFkAttributeRename.map.xml | 44 +++++++++++++++++++
.../testFkAttributeRename.map.xml-result | 45 +++++++++++++++++++
.../tools/dbimport/testFkAttributeRename.sql | 33 ++++++++++++++
7 files changed, 177 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
index 9bb2a84..3b032ba 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
@@ -159,6 +159,9 @@ public class EntityMergeSupport {
if (shouldAddToObjEntity(entity, dbRelationship)) {
addMissingRelationship(entity, dbRelationship);
+ if (removingMeaningfulFKs) {
+ getRidOfAttributesThatAreNowSrcAttributesForRelationships(entity);
+ }
}
return true;
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/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 740698c..238791b 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -21,6 +21,7 @@ CAY-2168 Split DbLoader to parts and clean it up
CAY-2169 Split DbMerger to parts and clean it up
Bug Fixes:
+CAY-2174 Change FK attribute name cause ObjAttribute appear after Reverse Engineering
----------------------------------
Release: 4.0.M4
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
index bbe88cd..3eac2f6 100644
--- a/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
+++ b/plugins/maven-cayenne-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
@@ -233,6 +233,11 @@ public class DbImporterMojoTest extends AbstractMojoTestCase {
}
@Test
+ public void testFkAttributeRename() throws Exception {
+ test("testFkAttributeRename");
+ }
+
+ @Test
public void testFilteringConfig() throws Exception {
DbImporterMojo cdbImport = getCdbImport("config/pom-01.xml");
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml
new file mode 100644
index 0000000..ed78d00
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <name>DbImporterMojo Test1</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-cayenne-plugin</artifactId>
+ <configuration>
+ <map>target/test-classes/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml</map>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+
+ <reverseEngineering>
+ <schema>
+ <name>SCHEMA_01</name>
+ </schema>
+ </reverseEngineering>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml
new file mode 100644
index 0000000..948e121
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<data-map xmlns="http://cayenne.apache.org/schema/9/modelMap"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://cayenne.apache.org/schema/9/modelMap http://cayenne.apache.org/schema/9/modelMap.xsd"
+ project-version="9">
+
+ <db-entity name="CHILD" schema="SCHEMA_01">
+ <db-attribute name="id" type="INTEGER" length="10"/>
+ <db-attribute name="parent_id" type="INTEGER" length="10"/>
+ </db-entity>
+ <db-entity name="PARENT" schema="SCHEMA_01">
+ <db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+ </obj-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ </obj-entity>
+ <db-relationship name="parent" source="CHILD" target="PARENT" toMany="false">
+ <db-attribute-pair source="parent_id" target="id"/>
+ </db-relationship>
+ <db-relationship name="children" source="PARENT" target="CHILD" toMany="true">
+ <db-attribute-pair source="id" target="parent_id"/>
+ </db-relationship>
+ <obj-relationship name="parent" source="Child" target="Parent" deleteRule="Nullify" db-relationship-path="parent"/>
+ <obj-relationship name="children" source="Parent" target="Child" deleteRule="Deny" db-relationship-path="children"/>
+</data-map>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result
new file mode 100644
index 0000000..d10b90d
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+<data-map xmlns="http://cayenne.apache.org/schema/9/modelMap"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://cayenne.apache.org/schema/9/modelMap http://cayenne.apache.org/schema/9/modelMap.xsd"
+ project-version="9">
+
+ <db-entity name="CHILD" schema="SCHEMA_01">
+ <db-attribute name="PAR" type="INTEGER" length="10"/>
+ <db-attribute name="id" type="INTEGER" length="10"/>
+ </db-entity>
+ <db-entity name="PARENT" schema="SCHEMA_01">
+ <db-attribute name="id" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+ </obj-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ </obj-entity>
+ <db-relationship name="parent" source="CHILD" target="PARENT" toMany="false">
+ <db-attribute-pair source="PAR" target="id"/>
+ </db-relationship>
+ <db-relationship name="children" source="PARENT" target="CHILD" toMany="true">
+ <db-attribute-pair source="id" target="PAR"/>
+ </db-relationship>
+ <obj-relationship name="parent" source="Child" target="Parent" deleteRule="Nullify" db-relationship-path="parent"/>
+ <obj-relationship name="children" source="Parent" target="Child" deleteRule="Deny" db-relationship-path="children"/>
+</data-map>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/802a5258/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql
----------------------------------------------------------------------
diff --git a/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql
new file mode 100644
index 0000000..07a65a9
--- /dev/null
+++ b/plugins/maven-cayenne-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql
@@ -0,0 +1,33 @@
+-- Licensed to the Apache Software Foundation (ASF) under one
+-- or more contributor license agreements. See the NOTICE file
+-- distributed with this work for additional information
+-- regarding copyright ownership. The ASF licenses this file
+-- to you under the Apache License, Version 2.0 (the
+-- "License"); you may not use this file except in compliance
+-- with the License. You may obtain a copy of the License at
+--
+-- http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing,
+-- software distributed under the License is distributed on an
+-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+-- KIND, either express or implied. See the License for the
+-- specific language governing permissions and limitations
+-- under the License.
+
+CREATE SCHEMA schema_01;
+SET SCHEMA schema_01;
+
+CREATE TABLE schema_01.parent (
+ id INTEGER NOT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE schema_01.child (
+ id INTEGER,
+ par INTEGER
+);
+
+ALTER TABLE schema_01.child
+ ADD FOREIGN KEY (par)
+ REFERENCES schema_01.parent (id);
\ No newline at end of file
[2/2] cayenne git commit: Merge branch '158'
Posted by sk...@apache.org.
Merge branch '158'
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/63ce5710
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/63ce5710
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/63ce5710
Branch: refs/heads/master
Commit: 63ce5710303480c73fbf53249adcf8170c787087
Parents: 2713876 802a525
Author: Savva Kolbachev <s....@gmail.com>
Authored: Mon Dec 19 14:47:03 2016 +0300
Committer: Savva Kolbachev <s....@gmail.com>
Committed: Mon Dec 19 14:47:03 2016 +0300
----------------------------------------------------------------------
.../merge/context/EntityMergeSupport.java | 3 ++
docs/doc/src/main/resources/RELEASE-NOTES.txt | 1 +
.../cayenne/tools/DbImporterMojoTest.java | 5 +++
.../dbimport/testFkAttributeRename-pom.xml | 46 ++++++++++++++++++++
.../dbimport/testFkAttributeRename.map.xml | 44 +++++++++++++++++++
.../testFkAttributeRename.map.xml-result | 45 +++++++++++++++++++
.../tools/dbimport/testFkAttributeRename.sql | 33 ++++++++++++++
7 files changed, 177 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/63ce5710/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/merge/context/EntityMergeSupport.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/63ce5710/docs/doc/src/main/resources/RELEASE-NOTES.txt
----------------------------------------------------------------------
diff --cc docs/doc/src/main/resources/RELEASE-NOTES.txt
index 55b2757,238791b..bfa6f15
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@@ -19,10 -19,9 +19,11 @@@ CAY-2165 Explicit "contribution" API fo
CAY-2166 Auto-loading of Cayenne modules
CAY-2168 Split DbLoader to parts and clean it up
CAY-2169 Split DbMerger to parts and clean it up
+CAY-2172 Cleanup Modeler import and migrate db actions
+CAY-2176 Java 7 diamond class generation templates
Bug Fixes:
+ CAY-2174 Change FK attribute name cause ObjAttribute appear after Reverse Engineering
----------------------------------
Release: 4.0.M4