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/01/31 07:38:07 UTC
[6/8] cayenne git commit: CAY-2214 cdbimport: rename
maven-cayenne-plugin - change module and folder name to
"cayenne-maven-plugin" - artifactId still is "maven-cayenne-plugin"
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.map.xml-result
new file mode 100644
index 0000000..a65e271
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.map.xml-result
@@ -0,0 +1,51 @@
+<?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">
+ <property name="defaultSchema" value="SCHEMA_01"/>
+ <db-entity name="CHILD" schema="SCHEMA_01">
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="PARENT_ID" type="CHAR" length="25"/>
+ </db-entity>
+ <db-entity name="PARENT" schema="SCHEMA_01">
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ <obj-attribute name="parentId" type="java.lang.String" db-attribute-path="PARENT_ID"/>
+ </obj-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.sql
new file mode 100644
index 0000000..dba8da6
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema.sql
@@ -0,0 +1,64 @@
+-- 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,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id),
+ UNIQUE (COL3)
+);
+
+CREATE TABLE schema_01.Child (
+ id INTEGER NOT NULL,
+ Parent_id CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id)
+);
+
+CREATE SCHEMA schema_02;
+SET SCHEMA schema_02;
+
+CREATE TABLE schema_02.Parent (
+ id INTEGER NOT NULL,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id),
+ UNIQUE (COL3)
+);
+
+CREATE TABLE schema_02.Child (
+ id INTEGER NOT NULL,
+ Parent_id CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id)
+);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-pom.xml
new file mode 100644
index 0000000..dd50897
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename-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>maven-cayenne-plugin</artifactId>
+ <configuration>
+ <map>target/test-classes/org/apache/cayenne/tools/dbimport/testFkAttributeRename.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/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml
new file mode 100644
index 0000000..948e121
--- /dev/null
+++ b/plugins/cayenne-maven-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/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.map.xml-result
new file mode 100644
index 0000000..d10b90d
--- /dev/null
+++ b/plugins/cayenne-maven-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/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFkAttributeRename.sql
new file mode 100644
index 0000000..07a65a9
--- /dev/null
+++ b/plugins/cayenne-maven-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
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink-pom.xml
new file mode 100644
index 0000000..1bcefa6
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink-pom.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.
+ -->
+<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/testFlattensManyToManyWithRecursiveLink.map.xml</map>
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+ <dbimport>
+ <defaultPackage>org.not.my.home</defaultPackage>
+ </dbimport>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.map.xml-result
new file mode 100644
index 0000000..8263273
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.map.xml-result
@@ -0,0 +1,48 @@
+<?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">
+ <property name="defaultPackage" value="org.not.my.home"/>
+ <db-entity name="A" schema="APP">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <db-entity name="A_A" schema="APP">
+ <db-attribute name="A1_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="A2_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="A" className="org.not.my.home.A" dbEntityName="A">
+ </obj-entity>
+ <db-relationship name="aAArray" source="A" target="A_A" toDependentPK="true" toMany="true">
+ <db-attribute-pair source="ID" target="A1_ID"/>
+ </db-relationship>
+ <db-relationship name="aAArray1" source="A" target="A_A" toDependentPK="true" toMany="true">
+ <db-attribute-pair source="ID" target="A2_ID"/>
+ </db-relationship>
+ <db-relationship name="toA" source="A_A" target="A" toMany="false">
+ <db-attribute-pair source="A1_ID" target="ID"/>
+ </db-relationship>
+ <db-relationship name="toA1" source="A_A" target="A" toMany="false">
+ <db-attribute-pair source="A2_ID" target="ID"/>
+ </db-relationship>
+ <obj-relationship name="aArray" source="A" target="A" db-relationship-path="aAArray.toA1"/>
+ <obj-relationship name="aArray1" source="A" target="A" db-relationship-path="aAArray1.toA"/>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.sql
new file mode 100644
index 0000000..9df54ab
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFlattensManyToManyWithRecursiveLink.sql
@@ -0,0 +1,31 @@
+-- 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 TABLE APP.A (
+ id INTEGER NOT NULL,
+
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.A_A (
+ A1_ID INTEGER NOT NULL,
+ A2_ID INTEGER NOT NULL,
+
+ PRIMARY KEY (A1_ID, A2_ID),
+ CONSTRAINT A_A1 FOREIGN KEY (A1_ID) REFERENCES APP.A (ID),
+ CONSTRAINT A_A2 FOREIGN KEY (A2_ID) REFERENCES APP.A (ID)
+);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema-pom.xml
new file mode 100644
index 0000000..e1bbd50
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema-pom.xml
@@ -0,0 +1,50 @@
+<?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/testForceDataMapSchema.map.xml</map>
+
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+
+ <dbimport>
+ <defaultPackage>com.example.test</defaultPackage>
+ <forceDataMapCatalog>true</forceDataMapCatalog>
+ <forceDataMapSchema>true</forceDataMapSchema>
+
+ <schema>SCHEMA_01</schema>
+ </dbimport>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml
new file mode 100644
index 0000000..1d9dea0
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml
@@ -0,0 +1,26 @@
+<?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">
+ <property name="defaultPackage" value="com.example.test"/>
+ <property name="defaultCatalog" value="XCATALOG"/>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml-result
new file mode 100644
index 0000000..0eaaffd
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.map.xml-result
@@ -0,0 +1,52 @@
+<?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">
+ <property name="defaultPackage" value="com.example.test"/>
+ <property name="defaultCatalog" value="XCATALOG"/>
+ <db-entity name="CHILD" catalog="XCATALOG">
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="PARENT_ID" type="CHAR" length="25"/>
+ </db-entity>
+ <db-entity name="PARENT" catalog="XCATALOG">
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Child" className="com.example.test.Child" dbEntityName="CHILD">
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ <obj-attribute name="parentId" type="java.lang.String" db-attribute-path="PARENT_ID"/>
+ </obj-entity>
+ <obj-entity name="Parent" className="com.example.test.Parent" dbEntityName="PARENT">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.sql
new file mode 100644
index 0000000..279065c
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testForceDataMapSchema.sql
@@ -0,0 +1,40 @@
+-- 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,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id),
+ UNIQUE (COL3)
+);
+
+CREATE TABLE schema_01.Child (
+ id INTEGER NOT NULL,
+ Parent_id CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id)
+);
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn-pom.xml
new file mode 100644
index 0000000..598607d
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn-pom.xml
@@ -0,0 +1,41 @@
+<?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/testImportAddTableAndColumn.map.xml</map>
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml
new file mode 100644
index 0000000..2317476
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml
@@ -0,0 +1,37 @@
+<?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="testImportAddTableAndColumn" schema="APP">
+ <db-attribute name="COL1" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ </db-entity>
+ <obj-entity name="testImportAddTableAndColumn" className="TestTable" dbEntityName="testImportAddTableAndColumn">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml-result
new file mode 100644
index 0000000..a5dd466
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.map.xml-result
@@ -0,0 +1,50 @@
+<?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="APP">
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="PARENT_ID" type="CHAR" length="25"/>
+ </db-entity>
+ <db-entity name="PARENT" schema="APP">
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ <obj-attribute name="parentId" type="java.lang.String" db-attribute-path="PARENT_ID"/>
+ </obj-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.sql
new file mode 100644
index 0000000..0bdef9a
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportAddTableAndColumn.sql
@@ -0,0 +1,37 @@
+-- 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 TABLE Parent (
+ id INTEGER NOT NULL,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id),
+ UNIQUE (COL3)
+);
+
+CREATE TABLE Child (
+ id INTEGER NOT NULL,
+ Parent_id CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (id)
+);
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap-pom.xml
new file mode 100644
index 0000000..440d340
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap-pom.xml
@@ -0,0 +1,41 @@
+<?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/testImportNewDataMap.map.xml</map>
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.map.xml-result
new file mode 100644
index 0000000..6133ac4
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.map.xml-result
@@ -0,0 +1,37 @@
+<?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="TEST_TABLE" schema="APP">
+ <db-attribute name="COL1" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ </db-entity>
+ <obj-entity name="TestTable" className="TestTable" dbEntityName="TEST_TABLE">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.sql
new file mode 100644
index 0000000..cb5b3c6
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportNewDataMap.sql
@@ -0,0 +1,27 @@
+-- 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 TABLE TEST_TABLE (
+ COL1 INTEGER NOT NULL,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (COL1),
+ UNIQUE (COL3)
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges-pom.xml
new file mode 100644
index 0000000..c1affd7
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges-pom.xml
@@ -0,0 +1,41 @@
+<?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/testImportWithoutChanges.map.xml</map>
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml
new file mode 100644
index 0000000..a22e016
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml
@@ -0,0 +1,37 @@
+<?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="testImportWithoutChanges" schema="APP">
+ <db-attribute name="COL1" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ </db-entity>
+ <obj-entity name="testImportWithoutChanges" className="TestTable" dbEntityName="testImportWithoutChanges">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml-result
new file mode 100644
index 0000000..25c85af
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.map.xml-result
@@ -0,0 +1,37 @@
+<?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="testImportWithoutChanges" schema="APP">
+ <db-attribute name="COL1" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="COL5" type="DATE" length="10"/>
+ </db-entity>
+ <obj-entity name="testImportWithoutChanges" className="TestTable" dbEntityName="testImportWithoutChanges">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col3" type="java.math.BigDecimal" db-attribute-path="COL3"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ <obj-attribute name="col5" type="java.util.Date" db-attribute-path="COL5"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.sql
new file mode 100644
index 0000000..beca35a
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testImportWithoutChanges.sql
@@ -0,0 +1,27 @@
+-- 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 TABLE testImportWithoutChanges (
+ COL1 INTEGER NOT NULL,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+ COL5 DATE,
+
+ PRIMARY KEY (COL1),
+ UNIQUE (COL3)
+)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne-pom.xml
new file mode 100644
index 0000000..418fd59
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne-pom.xml
@@ -0,0 +1,41 @@
+<?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/testOneToOne.map.xml</map>
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.map.xml-result
new file mode 100644
index 0000000..203c001
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.map.xml-result
@@ -0,0 +1,58 @@
+<?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="PICK_SCHEDULE" schema="APP">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="OWNER_ID" type="INTEGER" length="10"/>
+ <db-attribute name="SELECTED_PLAYER_ID" type="INTEGER" length="10"/>
+ </db-entity>
+ <db-entity name="PLAYER" schema="APP">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <db-entity name="PLAYER_INFO" schema="APP">
+ <db-attribute name="PLAYER_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="PickSchedule" className="PickSchedule" dbEntityName="PICK_SCHEDULE">
+ <obj-attribute name="ownerId" type="int" db-attribute-path="OWNER_ID"/>
+ </obj-entity>
+ <obj-entity name="Player" className="Player" dbEntityName="PLAYER">
+ </obj-entity>
+ <obj-entity name="PlayerInfo" className="PlayerInfo" dbEntityName="PLAYER_INFO">
+ </obj-entity>
+ <db-relationship name="selectedPlayer" source="PICK_SCHEDULE" target="PLAYER" toMany="false">
+ <db-attribute-pair source="SELECTED_PLAYER_ID" target="ID"/>
+ </db-relationship>
+ <db-relationship name="pickSchedules" source="PLAYER" target="PICK_SCHEDULE" toMany="true">
+ <db-attribute-pair source="ID" target="SELECTED_PLAYER_ID"/>
+ </db-relationship>
+ <db-relationship name="playerInfo" source="PLAYER" target="PLAYER_INFO" toDependentPK="true" toMany="false">
+ <db-attribute-pair source="ID" target="PLAYER_ID"/>
+ </db-relationship>
+ <db-relationship name="player" source="PLAYER_INFO" target="PLAYER" toMany="false">
+ <db-attribute-pair source="PLAYER_ID" target="ID"/>
+ </db-relationship>
+ <obj-relationship name="selectedPlayer" source="PickSchedule" target="Player" deleteRule="Nullify" db-relationship-path="selectedPlayer"/>
+ <obj-relationship name="pickSchedules" source="Player" target="PickSchedule" deleteRule="Deny" db-relationship-path="pickSchedules"/>
+ <obj-relationship name="playerInfo" source="Player" target="PlayerInfo" deleteRule="Nullify" db-relationship-path="playerInfo"/>
+ <obj-relationship name="player" source="PlayerInfo" target="Player" deleteRule="Nullify" db-relationship-path="player"/>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.sql
new file mode 100644
index 0000000..b676ed9
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testOneToOne.sql
@@ -0,0 +1,41 @@
+-- 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 TABLE player (
+ id INTEGER NOT NULL,
+
+ PRIMARY KEY (id)
+);
+
+
+-- one-to-one relationship
+CREATE TABLE player_info (
+ player_id INTEGER NOT NULL,
+
+ PRIMARY KEY (player_id),
+ CONSTRAINT fk_player_info FOREIGN KEY (player_id) REFERENCES player (id)
+);
+
+-- one-to-many relationship
+CREATE TABLE pick_schedule (
+ id INTEGER NOT NULL,
+ owner_id INTEGER,
+ selected_player_id INTEGER,
+ PRIMARY KEY (id),
+
+ CONSTRAINT fk_pick_schedule_player1 FOREIGN KEY (selected_player_id) REFERENCES player (id)
+)
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings-pom.xml
new file mode 100644
index 0000000..ea24dc8
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings-pom.xml
@@ -0,0 +1,47 @@
+<?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/testPreserveCustomObjMappings.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/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml
new file mode 100644
index 0000000..909c5f9
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml
@@ -0,0 +1,33 @@
+<?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">
+ <property name="defaultSchema" value="SCHEMA_01"/>
+ <db-entity name="PARENT" schema="SCHEMA_01">
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml-result
new file mode 100644
index 0000000..d874808
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.map.xml-result
@@ -0,0 +1,35 @@
+<?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">
+ <property name="defaultSchema" value="SCHEMA_01"/>
+ <db-entity name="PARENT" schema="SCHEMA_01">
+ <db-attribute name="COL2" type="CHAR" length="25"/>
+ <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+ <db-attribute name="COL4" type="VARCHAR" length="25"/>
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ <obj-attribute name="col2" type="java.lang.String" db-attribute-path="COL2"/>
+ <obj-attribute name="col4" type="java.lang.String" db-attribute-path="COL4"/>
+ </obj-entity>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.sql
new file mode 100644
index 0000000..32be3a5
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveCustomObjMappings.sql
@@ -0,0 +1,28 @@
+-- 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,
+ COL2 CHAR(25),
+ COL3 DECIMAL(10,2),
+ COL4 VARCHAR(25),
+
+ PRIMARY KEY (id)
+ );
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships-pom.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships-pom.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships-pom.xml
new file mode 100644
index 0000000..8056381
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships-pom.xml
@@ -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.
+ -->
+<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/testPreserveRelationships.map.xml</map>
+ <dataSource>
+ <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+ <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+ </dataSource>
+ <dbimport>
+ <!-- it doesn't matter true or false, but initial question was about this flag -->
+ <skipRelationshipsLoading>true</skipRelationshipsLoading>
+ </dbimport>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml
new file mode 100644
index 0000000..5d3c059
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.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="APP">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ <db-attribute name="PARENT_ID" type="INTEGER" length="10"/>
+ </db-entity>
+ <db-entity name="PARENT" schema="APP">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+ <obj-attribute name="parentId" type="java.lang.Integer" db-attribute-path="PARENT_ID"/>
+ </obj-entity>
+ <obj-entity name="Parent" className="Parent" dbEntityName="PARENT">
+ </obj-entity>
+ <db-relationship name="toParent" source="CHILD" target="PARENT" toMany="false">
+ <db-attribute-pair source="PARENT_ID" target="ID"/>
+ </db-relationship>
+ <db-relationship name="toParent" source="PARENT" target="CHILD" toMany="false">
+ <db-attribute-pair source="ID" target="PARENT_ID"/>
+ </db-relationship>
+ <obj-relationship name="toParent" source="Child" target="Parent" deleteRule="Nullify" db-relationship-path="toParent"/>
+ <obj-relationship name="toParent" source="Parent" target="Child" deleteRule="Nullify" db-relationship-path="toParent"/>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml-result
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml-result b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml-result
new file mode 100644
index 0000000..818c17f
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml-result
@@ -0,0 +1,34 @@
+<?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="APP">
+ <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+ </db-entity>
+ <db-entity name="PARENT" schema="APP">
+ <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>
+</data-map>
http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql
----------------------------------------------------------------------
diff --git a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql
new file mode 100644
index 0000000..86b26bc
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql
@@ -0,0 +1,28 @@
+-- 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 TABLE APP.Parent (
+ id INTEGER NOT NULL,
+
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.Child (
+ id INTEGER NOT NULL,
+
+ PRIMARY KEY (id)
+);
\ No newline at end of file