You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by nt...@apache.org on 2017/08/17 09:18:28 UTC
cayenne git commit: CAY-2347 cdbimport: can't get all relationships
on the first pass release notes test case as actual fix was made by CAY-2321
Repository: cayenne
Updated Branches:
refs/heads/STABLE-4.0 be34db113 -> f6a2f4c78
CAY-2347 cdbimport: can't get all relationships on the first pass
release notes
test case as actual fix was made by CAY-2321
Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/f6a2f4c7
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/f6a2f4c7
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/f6a2f4c7
Branch: refs/heads/STABLE-4.0
Commit: f6a2f4c784dca89d4125edab8b3cb86cff1407bb
Parents: be34db1
Author: Nikita Timofeev <st...@gmail.com>
Authored: Thu Aug 17 12:12:59 2017 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Thu Aug 17 12:12:59 2017 +0300
----------------------------------------------------------------------
docs/doc/src/main/resources/RELEASE-NOTES.txt | 2 +
.../cayenne/tools/DbImporterMojoTest.java | 5 ++
.../testAddedFlattenedRelationship-pom.xml | 49 ++++++++++++++++++++
.../testAddedFlattenedRelationship.map.xml | 29 ++++++++++++
...estAddedFlattenedRelationship.map.xml-result | 37 +++++++++++++++
.../dbimport/testAddedFlattenedRelationship.sql | 43 +++++++++++++++++
6 files changed, 165 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f6a2f4c7/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 227d22a..33c9d0a 100644
--- a/docs/doc/src/main/resources/RELEASE-NOTES.txt
+++ b/docs/doc/src/main/resources/RELEASE-NOTES.txt
@@ -15,8 +15,10 @@ Date:
Bug Fixes:
CAY-2319 Modeler: Embeddable > Attributes. Undo does not cancel pasted objects
+CAY-2321 cdbimport: Reverse relationship is not created after adding and rev engineeering new db table
CAY-2323 Modeler: Graph. No warning while saving the image with existing name
CAY-2331 cgen: broken templates for data map
+CAY-2347 cdbimport: can't get all relationships on the first pass
CAY-2349 Cache issue: 'SelectQuery' with prefetches loses relationships
CAY-2350 Expression: NotIn with empty collection returns empty result
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f6a2f4c7/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
index d3ac706..1f3a29a 100644
--- a/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
+++ b/maven-plugins/cayenne-maven-plugin/src/test/java/org/apache/cayenne/tools/DbImporterMojoTest.java
@@ -267,6 +267,11 @@ public class DbImporterMojoTest extends AbstractMojoTestCase {
}
@Test
+ public void testAddedFlattenedRelationship() throws Exception {
+ test("testAddedFlattenedRelationship");
+ }
+
+ @Test
public void testFilteringConfig() throws Exception {
DbImporterMojo cdbImport = getCdbImport("config/pom-01.xml");
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f6a2f4c7/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship-pom.xml
new file mode 100644
index 0000000..a4ccf75
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship-pom.xml
@@ -0,0 +1,49 @@
+<?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>cayenne-maven-plugin</artifactId>
+ <configuration>
+ <map>target/test-classes/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml</map>
+
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+
+ <dbimport>
+ <schema>
+ <name>SCHEMA_01</name>
+ </schema>
+ </dbimport>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f6a2f4c7/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml
new file mode 100644
index 0000000..c209eaa
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml
@@ -0,0 +1,29 @@
+<?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/10/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="A" schema="SCHEMA_01">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="A" className="A" dbEntityName="A"/>
+</data-map>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f6a2f4c7/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml-result
new file mode 100644
index 0000000..2cc013f
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.map.xml-result
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="A" schema="SCHEMA_01">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <db-entity name="A_B" schema="SCHEMA_01">
+ <db-attribute name="A_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="B_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <db-entity name="B" schema="SCHEMA_01">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+
+ <obj-entity name="A" className="A" dbEntityName="A"/>
+ <obj-entity name="B" className="B" dbEntityName="B"/>
+
+ <db-relationship name="aBs" source="A" target="A_B" toDependentPK="true" toMany="true">
+ <db-attribute-pair source="ID" target="A_ID"/>
+ </db-relationship>
+ <db-relationship name="a" source="A_B" target="A" toMany="false">
+ <db-attribute-pair source="A_ID" target="ID"/>
+ </db-relationship>
+
+ <db-relationship name="aBs" source="B" target="A_B" toDependentPK="true" toMany="true">
+ <db-attribute-pair source="ID" target="B_ID"/>
+ </db-relationship>
+ <db-relationship name="b" source="A_B" target="B" toMany="false">
+ <db-attribute-pair source="B_ID" target="ID"/>
+ </db-relationship>
+
+ <obj-relationship name="bs" source="A" target="B" db-relationship-path="aBs.b"/>
+ <obj-relationship name="as" source="B" target="A" db-relationship-path="aBs.a"/>
+</data-map>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/f6a2f4c7/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.sql
new file mode 100644
index 0000000..cd2904d
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testAddedFlattenedRelationship.sql
@@ -0,0 +1,43 @@
+-- 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.A (
+ ID INTEGER NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE SCHEMA_01.B (
+ ID INTEGER NOT NULL,
+ PRIMARY KEY (ID)
+);
+
+CREATE TABLE SCHEMA_01.A_B (
+ A_ID INTEGER NOT NULL,
+ B_ID INTEGER NOT NULL
+ ,PRIMARY KEY (A_ID, B_ID)
+);
+
+ALTER TABLE SCHEMA_01.A_B
+ ADD FOREIGN KEY (A_ID)
+ REFERENCES SCHEMA_01.A (ID);
+
+ALTER TABLE SCHEMA_01.A_B
+ ADD FOREIGN KEY (B_ID)
+ REFERENCES SCHEMA_01.B (ID);
\ No newline at end of file