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/02/01 14:46:54 UTC

[07/10] cayenne git commit: CAY-2215 rename "plugins" folder and "cayenne-plugins-parent" module New names are "maven-plugins" and "cayenne-maven-plugins-parent"

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.map.xml-result b/maven-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/maven-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/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testPreserveRelationships.sql
new file mode 100644
index 0000000..86b26bc
--- /dev/null
+++ b/maven-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

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude-pom.xml
new file mode 100644
index 0000000..74867d4
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude-pom.xml
@@ -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.
+  -->
+<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/testSchemasAndTableExclude.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>
+                        <excludeTable>Child</excludeTable>
+                    </dbimport>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.map.xml-result
new file mode 100644
index 0000000..1870f1b
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.map.xml-result
@@ -0,0 +1,38 @@
+<?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="COL5" type="DATE" length="10"/>
+        <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="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/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.sql
new file mode 100644
index 0000000..dba8da6
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSchemasAndTableExclude.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/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading-pom.xml
new file mode 100644
index 0000000..1b5c8fc
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading-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>cayenne-maven-plugin</artifactId>
+				<configuration>
+					<map>target/test-classes/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml</map>
+					<dataSource>
+						<driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+						<url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+					</dataSource>
+
+                    <dbimport>
+                        <skipPrimaryKeyLoading>true</skipPrimaryKeyLoading>
+                    </dbimport>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml
new file mode 100644
index 0000000..1f08680
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml
@@ -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="defaultPackage" value="com.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="B" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="NewName" className="NewName" dbEntityName="A">
+    </obj-entity>
+    <obj-entity name="B" className="B" dbEntityName="B">
+    </obj-entity>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml-result
new file mode 100644
index 0000000..4da960f
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.map.xml-result
@@ -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.
+  -->
+<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.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="B" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="C" schema="APP">
+		<db-attribute name="ID" type="INTEGER" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="NewName" className="NewName" dbEntityName="A">
+    </obj-entity>
+    <obj-entity name="B" className="B" dbEntityName="B">
+    </obj-entity>
+	<obj-entity name="C" className="com.my.home.C" dbEntityName="C">
+		<obj-attribute name="id" type="int" db-attribute-path="ID"/>
+    </obj-entity>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.sql
new file mode 100644
index 0000000..4bf663c
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipPrimaryKeyLoading.sql
@@ -0,0 +1,30 @@
+--  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.B (
+  id INTEGER NOT NULL
+);
+
+CREATE TABLE APP.C (
+  id INTEGER NOT NULL
+);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-pom.xml
new file mode 100644
index 0000000..f2b4c11
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading-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>cayenne-maven-plugin</artifactId>
+				<configuration>
+					<map>target/test-classes/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml</map>
+					<dataSource>
+						<driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+						<url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+					</dataSource>
+
+                    <dbimport>
+                        <skipRelationshipsLoading>true</skipRelationshipsLoading>
+                    </dbimport>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml
new file mode 100644
index 0000000..a245765
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml
@@ -0,0 +1,55 @@
+<?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.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_B" schema="APP">
+        <db-attribute name="A_ID" type="INTEGER" isMandatory="true" length="10"/>
+        <db-attribute name="B_ID" type="INTEGER" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="B" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="A" className="A" dbEntityName="A">
+    </obj-entity>
+    <obj-entity name="AB" className="AB" dbEntityName="A_B">
+    </obj-entity>
+    <obj-entity name="B" className="B" dbEntityName="B">
+    </obj-entity>
+    <db-relationship name="aBArray" source="A" target="A_B" toMany="true">
+        <db-attribute-pair source="ID" target="A_ID"/>
+    </db-relationship>
+    <db-relationship name="toA" source="A_B" target="A" toMany="false">
+        <db-attribute-pair source="A_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="toB" source="A_B" target="B" toMany="false">
+        <db-attribute-pair source="B_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="aBArray" source="B" target="A_B" toMany="true">
+        <db-attribute-pair source="ID" target="B_ID"/>
+    </db-relationship>
+    <obj-relationship name="toA" source="AB" target="A" deleteRule="Nullify" db-relationship-path="toA"/>
+    <obj-relationship name="aBArray" source="B" target="AB" deleteRule="Deny" db-relationship-path="aBArray"/>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
new file mode 100644
index 0000000..a245765
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.map.xml-result
@@ -0,0 +1,55 @@
+<?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.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_B" schema="APP">
+        <db-attribute name="A_ID" type="INTEGER" isMandatory="true" length="10"/>
+        <db-attribute name="B_ID" type="INTEGER" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="B" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="A" className="A" dbEntityName="A">
+    </obj-entity>
+    <obj-entity name="AB" className="AB" dbEntityName="A_B">
+    </obj-entity>
+    <obj-entity name="B" className="B" dbEntityName="B">
+    </obj-entity>
+    <db-relationship name="aBArray" source="A" target="A_B" toMany="true">
+        <db-attribute-pair source="ID" target="A_ID"/>
+    </db-relationship>
+    <db-relationship name="toA" source="A_B" target="A" toMany="false">
+        <db-attribute-pair source="A_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="toB" source="A_B" target="B" toMany="false">
+        <db-attribute-pair source="B_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="aBArray" source="B" target="A_B" toMany="true">
+        <db-attribute-pair source="ID" target="B_ID"/>
+    </db-relationship>
+    <obj-relationship name="toA" source="AB" target="A" deleteRule="Nullify" db-relationship-path="toA"/>
+    <obj-relationship name="aBArray" source="B" target="AB" deleteRule="Deny" db-relationship-path="aBArray"/>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
new file mode 100644
index 0000000..0241d1d
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSkipRelationshipsLoading.sql
@@ -0,0 +1,36 @@
+--  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.B (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.A_B (
+  A_ID INTEGER NOT NULL,
+  B_ID INTEGER NOT NULL,
+
+  CONSTRAINT A_B_A FOREIGN KEY (A_ID) REFERENCES APP.A (ID),
+  CONSTRAINT A_B_B FOREIGN KEY (B_ID) REFERENCES APP.B (ID)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-pom.xml
new file mode 100644
index 0000000..daf5b59
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering-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>cayenne-maven-plugin</artifactId>
+                <configuration>
+                    <map>
+                        target/test-classes/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
+                    </map>
+
+                    <dataSource>
+                        <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                        <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    </dataSource>
+
+                    <adapter>org.apache.cayenne.dba.postgres.PostgresAdapter</adapter>
+
+                    <dbimport>
+                        <catalog>DbImporterMojoTest1</catalog>
+                    </dbimport>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
new file mode 100644
index 0000000..81fc363
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testSupportsCatalogsOnReverseEngineering.map.xml
@@ -0,0 +1,25 @@
+<?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.my.home"/>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes-pom.xml
new file mode 100644
index 0000000..ff20c79
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes-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>cayenne-maven-plugin</artifactId>
+				<configuration>
+					<map>target/test-classes/org/apache/cayenne/tools/dbimport/testTableTypes.map.xml</map>
+					<dataSource>
+						<driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+						<url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+					</dataSource>
+
+                    <dbimport>
+                        <tableType>TABLE</tableType>
+                    </dbimport>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.map.xml-result
new file mode 100644
index 0000000..cdc9ddd
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.map.xml-result
@@ -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/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="PERSON" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="Person" className="Person" dbEntityName="PERSON">
+    </obj-entity>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.sql
new file mode 100644
index 0000000..cb7d3f5
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testTableTypes.sql
@@ -0,0 +1,25 @@
+--  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 Person (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE VIEW girl (id) AS SELECT id FROM Person;
+CREATE VIEW v_vview (id) AS SELECT id FROM Person;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-pom.xml
new file mode 100644
index 0000000..0c80294
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany-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>cayenne-maven-plugin</artifactId>
+				<configuration>
+					<map>target/test-classes/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.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/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
new file mode 100644
index 0000000..689a94a
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml
@@ -0,0 +1,55 @@
+<?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.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_B" schema="APP">
+        <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="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="A" className="A" dbEntityName="A">
+    </obj-entity>
+    <obj-entity name="AB" className="AB" dbEntityName="A_B">
+    </obj-entity>
+    <obj-entity name="B" className="B" dbEntityName="B">
+    </obj-entity>
+    <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="toA" source="A_B" target="A" toMany="false">
+        <db-attribute-pair source="A_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="toB" source="A_B" target="B" toMany="false">
+        <db-attribute-pair source="B_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>
+    <obj-relationship name="toA" source="AB" target="A" deleteRule="Nullify" db-relationship-path="toA"/>
+    <obj-relationship name="aBs" source="B" target="AB" deleteRule="Deny" db-relationship-path="aBs"/>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
new file mode 100644
index 0000000..46d6a84
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.map.xml-result
@@ -0,0 +1,88 @@
+<?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_B" schema="APP">
+        <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="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="C" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="X" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="X_Y" schema="APP">
+        <db-attribute name="X_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+        <db-attribute name="Y_ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="Y" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="A" className="A" dbEntityName="A">
+    </obj-entity>
+    <obj-entity name="AB" className="AB" dbEntityName="A_B">
+    </obj-entity>
+    <obj-entity name="B" className="B" dbEntityName="B">
+    </obj-entity>
+    <obj-entity name="C" className="org.not.my.home.C" dbEntityName="C">
+    </obj-entity>
+    <obj-entity name="X" className="org.not.my.home.X" dbEntityName="X">
+    </obj-entity>
+    <obj-entity name="Y" className="org.not.my.home.Y" dbEntityName="Y">
+    </obj-entity>
+    <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="toA" source="A_B" target="A" toMany="false">
+        <db-attribute-pair source="A_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="toB" source="A_B" target="B" toMany="false">
+        <db-attribute-pair source="B_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="xIes" source="X" target="X_Y" toDependentPK="true" toMany="true">
+        <db-attribute-pair source="ID" target="X_ID"/>
+    </db-relationship>
+    <db-relationship name="x" source="X_Y" target="X" toMany="false">
+        <db-attribute-pair source="X_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="y" source="X_Y" target="Y" toMany="false">
+        <db-attribute-pair source="Y_ID" target="ID"/>
+    </db-relationship>
+    <db-relationship name="xIes" source="Y" target="X_Y" toDependentPK="true" toMany="true">
+        <db-attribute-pair source="ID" target="Y_ID"/>
+    </db-relationship>
+    <obj-relationship name="toA" source="AB" target="A" deleteRule="Nullify" db-relationship-path="toA"/>
+    <obj-relationship name="aBs" source="B" target="AB" deleteRule="Deny" db-relationship-path="aBs"/>
+    <obj-relationship name="ies" source="X" target="Y" db-relationship-path="xIes.y"/>
+    <obj-relationship name="xes" source="Y" target="X" db-relationship-path="xIes.x"/>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.sql
new file mode 100644
index 0000000..b6f4eac
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testUnFlattensManyToMany.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 TABLE APP.A (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.B (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.A_B (
+  A_ID INTEGER NOT NULL,
+  B_ID INTEGER NOT NULL,
+
+  PRIMARY KEY (A_ID, B_ID),
+  CONSTRAINT A_B_A FOREIGN KEY (A_ID) REFERENCES APP.A (ID),
+  CONSTRAINT A_B_B FOREIGN KEY (B_ID) REFERENCES APP.B (ID)
+);
+
+CREATE TABLE APP.C (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.X (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.Y (
+  id INTEGER NOT NULL,
+
+  PRIMARY KEY (id)
+);
+
+CREATE TABLE APP.X_Y (
+  X_ID INTEGER NOT NULL,
+  Y_ID INTEGER NOT NULL,
+
+  PRIMARY KEY (X_ID, Y_ID),
+  CONSTRAINT X_Y_X FOREIGN KEY (X_ID) REFERENCES APP.X (ID),
+  CONSTRAINT X_Y_Y FOREIGN KEY (Y_ID) REFERENCES APP.Y (ID)
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude-pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude-pom.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude-pom.xml
new file mode 100644
index 0000000..1d5f4c0
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude-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>cayenne-maven-plugin</artifactId>
+                <configuration>
+                    <map>target/test-classes/org/apache/cayenne/tools/dbimport/testViewsExclude.map.xml</map>
+                    <dataSource>
+                        <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                        <url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    </dataSource>
+
+                    <dbimport>
+                        <excludeTable>^V_.*</excludeTable>
+                    </dbimport>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.map.xml-result
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.map.xml-result b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.map.xml-result
new file mode 100644
index 0000000..d24df6e
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.map.xml-result
@@ -0,0 +1,43 @@
+<?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="GIRL" schema="APP">
+        <db-attribute name="ID" type="INTEGER" isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="PERSON" 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="Girl" className="Girl" dbEntityName="GIRL">
+        <obj-attribute name="id" type="int" db-attribute-path="ID"/>
+    </obj-entity>
+    <obj-entity name="Person" className="Person" dbEntityName="PERSON">
+        <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/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.sql
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.sql b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.sql
new file mode 100644
index 0000000..1af3f84
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testViewsExclude.sql
@@ -0,0 +1,30 @@
+--  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 Person (
+  id INTEGER NOT NULL,
+  COL2 CHAR(25),
+  COL3 DECIMAL(10,2),
+  COL4 VARCHAR(25),
+  COL5 DATE,
+
+  PRIMARY KEY (id),
+  UNIQUE (COL3)
+);
+
+CREATE VIEW girl (id) AS SELECT id FROM Person;
+CREATE VIEW v_vview (id) AS SELECT id FROM Person;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom1.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom1.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom1.xml
new file mode 100644
index 0000000..3bb6207
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom1.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.   
+-->
+<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/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom2.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom2.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom2.xml
new file mode 100644
index 0000000..4ea460c
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom2.xml
@@ -0,0 +1,39 @@
+<?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 Test2</name>
+
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>cayenne-maven-plugin</artifactId>
+				<configuration>
+					<dbimport>
+						<meaningfulPkTables>x,b*</meaningfulPkTables>
+					</dbimport>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom3.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom3.xml b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom3.xml
new file mode 100644
index 0000000..be64020
--- /dev/null
+++ b/maven-plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimporter-pom3.xml
@@ -0,0 +1,39 @@
+<?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>
+					<dbimport>
+						<meaningfulPkTables>*</meaningfulPkTables>
+					</dbimport>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/maven-cayenne-modeler-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/maven-cayenne-modeler-plugin/pom.xml b/maven-plugins/maven-cayenne-modeler-plugin/pom.xml
new file mode 100644
index 0000000..f3b05d1
--- /dev/null
+++ b/maven-plugins/maven-cayenne-modeler-plugin/pom.xml
@@ -0,0 +1,111 @@
+<?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/maven-v4_0_0.xsd">
+
+	<parent>
+		<artifactId>cayenne-plugins-parent</artifactId>
+		<groupId>org.apache.cayenne.plugins</groupId>
+		<version>4.0.M5-SNAPSHOT</version>
+	</parent>
+
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>maven-cayenne-modeler-plugin</artifactId>
+	<packaging>maven-plugin</packaging>
+	<name>maven-cayenne-modeler-plugin: Cayenne Modeler Maven Plugin</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-plugin-api</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-artifact</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.maven</groupId>
+			<artifactId>maven-project</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.maven.plugin-tools</groupId>
+			<artifactId>maven-plugin-tools-api</artifactId>
+		</dependency>
+
+        <dependency>
+			<groupId>org.apache.cayenne.modeler</groupId>
+			<artifactId>cayenne-modeler</artifactId>
+			<version>${project.version}</version>
+			<exclusions>
+				<exclusion>
+					<groupId>foundrylogic.vpp</groupId>
+					<artifactId>vpp</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+        <dependency>
+			<groupId>org.apache.cayenne</groupId>
+			<artifactId>cayenne-server</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+
+	</dependencies>
+
+    <build>
+        <plugins>
+			<plugin>
+				<artifactId>maven-plugin-plugin</artifactId>
+				<configuration>
+					<goalPrefix>cayenne-modeler</goalPrefix>
+				</configuration>
+			</plugin>
+        </plugins>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>code-quality</id>
+
+            <activation>
+                <property>
+                    <name>!fast-and-dirty</name>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <artifactId>maven-checkstyle-plugin</artifactId>
+                        <!--<configuration>
+                            <suppressionsLocation>${project.basedir}/cayenne-checkstyle-suppression.xml</suppressionsLocation>
+                        </configuration>-->
+                    </plugin>
+                    <plugin>
+                        <artifactId>maven-pmd-plugin</artifactId>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/maven-cayenne-modeler-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/maven-cayenne-modeler-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java b/maven-plugins/maven-cayenne-modeler-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
new file mode 100644
index 0000000..75e08b8
--- /dev/null
+++ b/maven-plugins/maven-cayenne-modeler-plugin/src/main/java/org/apache/cayenne/tools/CayenneModelerMojo.java
@@ -0,0 +1,85 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import java.io.File;
+
+import org.apache.cayenne.modeler.Main;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+
+/**
+ * Maven mojo to start up the Cayenne modeler from the command-line.
+ * 
+ * @since 3.0
+ * 
+ * @prefix cayenne-modeler
+ * @goal run
+ */
+public class CayenneModelerMojo extends AbstractMojo {
+
+	/**
+	 * Name of the model file to open.
+	 * 
+	 * @parameter expression="${modeler.modelFile}
+	 */
+	private File modelFile;
+
+	/**
+	 * Project instance.
+	 * 
+	 * @parameter default-value="${project}"
+	 * @required
+	 * @readonly
+	 */
+	private MavenProject project;
+
+	private File lookupModelFile() {
+		if (modelFile != null && modelFile.isFile()) {
+			return modelFile;
+		}
+
+		return null;
+	}
+
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		// setup the system property to tell the modeler where to generate the
+		// java source files.
+		System.setProperty("cayenne.cgen.destdir", project.getBuild()
+				.getSourceDirectory());
+
+		// start the modeler with the provided model file, if it exists.
+		File f = lookupModelFile();
+		if (f != null && f.exists() && !f.isDirectory()) {
+			Main.main(new String[] { f.getAbsolutePath() });
+		} else {
+			Main.main(new String[] {});
+		}
+
+		// Block until the modeler finishes executing.
+		try {
+			Thread.currentThread().join();
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/maven-cayenne-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/maven-plugins/maven-cayenne-plugin/pom.xml b/maven-plugins/maven-cayenne-plugin/pom.xml
new file mode 100644
index 0000000..cfd365c
--- /dev/null
+++ b/maven-plugins/maven-cayenne-plugin/pom.xml
@@ -0,0 +1,144 @@
+<?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">
+    <parent>
+        <artifactId>cayenne-plugins-parent</artifactId>
+        <groupId>org.apache.cayenne.plugins</groupId>
+        <version>4.0.M5-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>maven-cayenne-plugin</artifactId>
+    <packaging>maven-plugin</packaging>
+    <name>maven-cayenne-plugin: Deprecated Cayenne Maven Plugin</name>
+
+    <dependencies>
+        
+        <dependency>
+            <groupId>org.apache.cayenne.plugins</groupId>
+            <artifactId>cayenne-maven-plugin</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven.plugin-tools</groupId>
+            <artifactId>maven-plugin-annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-plugin-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-core</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-artifact</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-compat</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-interpolation</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.codehaus.plexus</groupId>
+            <artifactId>plexus-container-default</artifactId>
+        </dependency>
+
+        <!-- Test deps -->
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.maven.plugin-testing</groupId>
+            <artifactId>maven-plugin-testing-harness</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>xmlunit</groupId>
+            <artifactId>xmlunit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-server</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cayenne</groupId>
+            <artifactId>cayenne-dbsync</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+            <type>test-jar</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cayenne.build-tools</groupId>
+            <artifactId>cayenne-test-utilities</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-plugin-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </reporting>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorOldMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorOldMojo.java b/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorOldMojo.java
new file mode 100644
index 0000000..38e30ec
--- /dev/null
+++ b/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/CayenneGeneratorOldMojo.java
@@ -0,0 +1,49 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Maven mojo to perform class generation from data map. This class is an Maven
+ * adapter to DefaultClassGenerator class.
+ *
+ * @deprecated use "cayenne-maven-plugin"
+ * @since 4.0
+ */
+@Mojo(name = "cgen", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
+public class CayenneGeneratorOldMojo extends CayenneGeneratorMojo {
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        getLog().warn("Plugin \"maven-cayenne-plugin\" has been deprecated.\n" +
+                "Please use \"cayenne-maven-plugin\":\n" +
+                "<plugin>\n" +
+                "   <groupId>org.apache.cayenne.plugins</groupId>\n" +
+                "   <artifactId>cayenne-maven-plugin</artifactId>\n" +
+                "   <version>LATEST</version>\n" +
+                "</plugin>\n");
+
+        super.execute();
+    }
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/a0cd93d6/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorOldMojo.java
----------------------------------------------------------------------
diff --git a/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorOldMojo.java b/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorOldMojo.java
new file mode 100644
index 0000000..d296969
--- /dev/null
+++ b/maven-plugins/maven-cayenne-plugin/src/main/java/org/apache/cayenne/tools/DbGeneratorOldMojo.java
@@ -0,0 +1,49 @@
+/*****************************************************************
+ *   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.
+ ****************************************************************/
+
+package org.apache.cayenne.tools;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+
+/**
+ * Maven mojo to perform class generation from data map. This class is a Maven
+ * adapter to DefaultClassGenerator class.
+ *
+ * @deprecated use "cayenne-maven-plugin"
+ * @since 4.0
+ */
+@Mojo(name = "cdbgen", defaultPhase = LifecyclePhase.PRE_INTEGRATION_TEST)
+public class DbGeneratorOldMojo extends DbGeneratorMojo {
+
+    @Override
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        getLog().warn("Plugin \"maven-cayenne-plugin\" has been deprecated.\n" +
+                "Please use \"cayenne-maven-plugin\":\n" +
+                "<plugin>\n" +
+                "   <groupId>org.apache.cayenne.plugins</groupId>\n" +
+                "   <artifactId>cayenne-maven-plugin</artifactId>\n" +
+                "   <version>LATEST</version>\n" +
+                "</plugin>\n");
+
+        super.execute();
+    }
+}