http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/cgen/testDomainMap.map.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/cgen/testDomainMap.map.xml 
b/plugins/cayenne-maven-plugin/src/test/resources/cgen/testDomainMap.map.xml
new file mode 100644
index 0000000..d0ff3f5
--- /dev/null
+++ b/plugins/cayenne-maven-plugin/src/test/resources/cgen/testDomainMap.map.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<data-map xmlns="http://cayenne.apache.org/schema/3.0/modelMap";
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+        xsi:schemaLocation="http://cayenne.apache.org/schema/3.0/modelMap 
http://cayenne.apache.org/schema/3.0/modelMap.xsd";
+        project-version="6">
+       <property name="defaultPackage" value="pack"/>
+       <embeddable className="pack.Embeddable">
+               <embeddable-attribute name="embAttr" type="java.lang.String" 
db-attribute-name="EMB_ATTR"/>
+       </embeddable>
+       <db-entity name="NotIncludedEntity">
+               <db-attribute name="id" type="BIGINT" isPrimaryKey="true" 
isMandatory="true"/>
+               <db-attribute name="name" type="VARCHAR" length="255"/>
+       </db-entity>
+       <db-entity name="TestEntity">
+               <db-attribute name="id" type="BIGINT" isPrimaryKey="true" 
isMandatory="true"/>
+               <db-attribute name="testAttr" type="VARCHAR" length="255"/>
+        <db-attribute name="TestRelEntity_ID" type="INTEGER"/>
+       </db-entity>
+       <db-entity name="TestExcludedEntity">
+               <db-attribute name="id" type="BIGINT" isPrimaryKey="true" 
isMandatory="true"/>
+               <db-attribute name="name" type="VARCHAR" length="255"/>
+       </db-entity>
+       <obj-entity name="NotIncludedEntity" className="pack.NotIncludedEntity" 
dbEntityName="NotIncludedEntity">
+               <obj-attribute name="name" type="java.lang.String" 
db-attribute-path="name"/>
+       </obj-entity>
+       <obj-entity name="TestEntity" className="pack.TestEntity" 
dbEntityName="TestEntity">
+               <embedded-attribute name="embeddedAtr" type="pack.Embeddable"/>
+               <obj-attribute name="testAttr" type="java.lang.String" 
db-attribute-path="testAttr"/>
+       </obj-entity>
+       <obj-entity name="TestExcludedEntity" 
className="pack.TestExcludedEntity" dbEntityName="TestExcludedEntity">
+               <obj-attribute name="name" type="java.lang.String" 
db-attribute-path="name"/>
+       </obj-entity>
+       <db-relationship name="childrenRel" source="TestEntity" 
target="TestEntity" toMany="true">
+               <db-attribute-pair source="id" target="id"/>
+       </db-relationship>
+       <db-relationship name="parentRel" source="TestEntity" 
target="TestEntity" toMany="false">
+               <db-attribute-pair source="id" target="id"/>
+       </db-relationship>
+    <db-relationship name="additionalRel" source="TestEntity" 
target="TestRelEntity" toMany="true">
+        <db-attribute-pair source="TestRelEntity_ID" target="ID"/>
+    </db-relationship>
+       <obj-relationship name="childrenRel" source="TestEntity" 
target="TestEntity" deleteRule="Deny" db-relationship-path="childrenRel"/>
+       <obj-relationship name="parentRel" source="TestEntity" 
target="TestEntity" deleteRule="Nullify" db-relationship-path="parentRel"/>
+    <obj-relationship name="additionalRel" source="TestEntity" 
target="TestRelEntity" deleteRule="Deny" db-relationship-path="additionalRel"/>
+</data-map>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
new file mode 100644
index 0000000..a4a6955
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-01.xml
@@ -0,0 +1,99 @@
+<?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/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <catalog>catalog-name-01</catalog>
+
+                        <catalog>
+                            <name>catalog-name-02</name>
+
+                            <schema>schema-name-01</schema>
+
+                            <schema>
+                                <name>schema-name-02</name>
+
+                                <includeTable>incTable-01</includeTable>
+                                <excludeTable>excTable-01</excludeTable>
+
+                                <includeTable>
+                                    <pattern>incTable-02</pattern>
+
+                                    
<includeColumn>includeColumn-01</includeColumn>
+                                    
<excludeColumn>excludeColumn-01</excludeColumn>
+                                </includeTable>
+
+                                <includeColumn>includeColumn-02</includeColumn>
+                                <excludeColumn>excludeColumn-02</excludeColumn>
+                            </schema>
+
+                            <includeColumn>includeColumn-03</includeColumn>
+                            <excludeColumn>excludeColumn-03</excludeColumn>
+                        </catalog>
+
+                        <schema>schema-name-03</schema>
+
+                        <schema>
+                            <name>schema-name-04</name>
+
+                            <includeTable>incTable-04</includeTable>
+                            <excludeTable>excTable-04</excludeTable>
+
+                            <includeTable>
+                                <pattern>incTable-05</pattern>
+
+                                <includeColumn>includeColumn-04</includeColumn>
+                                <excludeColumn>excludeColumn-04</excludeColumn>
+                            </includeTable>
+
+                            <includeColumn>includeColumn-04</includeColumn>
+                            <excludeColumn>excludeColumn-04</excludeColumn>
+                        </schema>
+
+                        <includeTable>incTable-06</includeTable>
+                        <excludeTable>excTable-06</excludeTable>
+
+                        <includeTable>
+                            <pattern>incTable-07</pattern>
+
+                            <includeColumn>includeColumn-06</includeColumn>
+                            <excludeColumn>excludeColumn-06</excludeColumn>
+                        </includeTable>
+
+                        <includeColumn>includeColumn-05</includeColumn>
+                        <excludeColumn>excludeColumn-05</excludeColumn>
+                    </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/config/pom-catalog-and-schema.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml
new file mode 100644
index 0000000..d3828ce
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog-and-schema.xml
@@ -0,0 +1,84 @@
+<?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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <catalog>
+                            <name>catalog-name</name>
+                            <schema>
+                                <name>schema-name</name>
+                                <includeTable>includeTable-01</includeTable>
+
+                                <includeTable>
+                                    <pattern>includeTable-02</pattern>
+                                </includeTable>
+
+                                <includeTable>
+                                    <pattern>includeTable-03</pattern>
+
+                                    
<includeColumn>includeColumn-01</includeColumn>
+                                    
<excludeColumn>excludeColumn-01</excludeColumn>
+                                </includeTable>
+
+                                <excludeTable>excludeTable-01</excludeTable>
+                                <excludeTable>
+                                    <pattern>excludeTable-02</pattern>
+                                </excludeTable>
+                                <excludeTable>excludeTable-03</excludeTable>
+
+                                <includeColumn>includeColumn-01</includeColumn>
+                                <includeColumn>
+                                    <pattern>includeColumn-02</pattern>
+                                </includeColumn>
+                                <includeColumn>includeColumn-03</includeColumn>
+                                <excludeColumn>excludeColumn-01</excludeColumn>
+                                <excludeColumn>
+                                    <pattern>excludeColumn-02</pattern>
+                                </excludeColumn>
+                                <excludeColumn>excludeColumn-03</excludeColumn>
+
+                                
<includeProcedure>includeProcedure-01</includeProcedure>
+                                <includeProcedure>
+                                    <pattern>includeProcedure-02</pattern>
+                                </includeProcedure>
+                                
<includeProcedure>includeProcedure-03</includeProcedure>
+                                
<excludeProcedure>excludeProcedure-01</excludeProcedure>
+                                <excludeProcedure>
+                                    <pattern>excludeProcedure-02</pattern>
+                                </excludeProcedure>
+                                
<excludeProcedure>excludeProcedure-03</excludeProcedure>
+                            </schema>
+                        </catalog>
+                    </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/config/pom-catalog.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml
new file mode 100644
index 0000000..9c919e8
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-catalog.xml
@@ -0,0 +1,87 @@
+<?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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <catalog>catalog-name-01</catalog>
+
+                        <catalog>
+                            <name>catalog-name-02</name>
+                        </catalog>
+
+                        <catalog>
+                            <name>catalog-name-03</name>
+                            <includeTable>includeTable-01</includeTable>
+
+                            <includeTable>
+                                <pattern>includeTable-02</pattern>
+                            </includeTable>
+
+                            <includeTable>
+                                <pattern>includeTable-03</pattern>
+
+                                <includeColumn>includeColumn-01</includeColumn>
+                                <excludeColumn>excludeColumn-01</excludeColumn>
+                            </includeTable>
+
+                            <excludeTable>excludeTable-01</excludeTable>
+                            <excludeTable>
+                                <pattern>excludeTable-02</pattern>
+                            </excludeTable>
+                            <excludeTable>excludeTable-03</excludeTable>
+
+                            <includeColumn>includeColumn-01</includeColumn>
+                            <includeColumn>
+                                <pattern>includeColumn-02</pattern>
+                            </includeColumn>
+                            <includeColumn>includeColumn-03</includeColumn>
+                            <excludeColumn>excludeColumn-01</excludeColumn>
+                            <excludeColumn>
+                                <pattern>excludeColumn-02</pattern>
+                            </excludeColumn>
+                            <excludeColumn>excludeColumn-03</excludeColumn>
+
+                            
<includeProcedure>includeProcedure-01</includeProcedure>
+                            <includeProcedure>
+                                <pattern>includeProcedure-02</pattern>
+                            </includeProcedure>
+                            
<includeProcedure>includeProcedure-03</includeProcedure>
+                            
<excludeProcedure>excludeProcedure-01</excludeProcedure>
+                            <excludeProcedure>
+                                <pattern>excludeProcedure-02</pattern>
+                            </excludeProcedure>
+                            
<excludeProcedure>excludeProcedure-03</excludeProcedure>
+                        </catalog>
+                    </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/config/pom-default-package.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml
new file mode 100644
index 0000000..7f09b88
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-default-package.xml
@@ -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.
+  -->
+<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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+                    <dbimport>
+                        <defaultPackage>com.example.test</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/config/pom-flat.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml
new file mode 100644
index 0000000..6987454
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-flat.xml
@@ -0,0 +1,78 @@
+<?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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <includeTable>includeTable-01</includeTable>
+
+                        <includeTable>
+                            <pattern>includeTable-02</pattern>
+                        </includeTable>
+
+                        <includeTable>
+                            <pattern>includeTable-03</pattern>
+
+                            <includeColumn>includeColumn-01</includeColumn>
+                            <excludeColumn>excludeColumn-01</excludeColumn>
+                        </includeTable>
+
+                        <excludeTable>excludeTable-01</excludeTable>
+                        <excludeTable>
+                            <pattern>excludeTable-02</pattern>
+                        </excludeTable>
+                        <excludeTable>excludeTable-03</excludeTable>
+
+                        <includeColumn>includeColumn-01</includeColumn>
+                        <includeColumn>
+                            <pattern>includeColumn-02</pattern>
+                        </includeColumn>
+                        <includeColumn>includeColumn-03</includeColumn>
+                        <excludeColumn>excludeColumn-01</excludeColumn>
+                        <excludeColumn>
+                            <pattern>excludeColumn-02</pattern>
+                        </excludeColumn>
+                        <excludeColumn>excludeColumn-03</excludeColumn>
+
+                        
<includeProcedure>includeProcedure-01</includeProcedure>
+                        <includeProcedure>
+                            <pattern>includeProcedure-02</pattern>
+                        </includeProcedure>
+                        
<includeProcedure>includeProcedure-03</includeProcedure>
+                        
<excludeProcedure>excludeProcedure-01</excludeProcedure>
+                        <excludeProcedure>
+                            <pattern>excludeProcedure-02</pattern>
+                        </excludeProcedure>
+                        
<excludeProcedure>excludeProcedure-03</excludeProcedure>
+                    </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/config/pom-mapping.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml
new file mode 100644
index 0000000..10c99da
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-mapping.xml
@@ -0,0 +1,67 @@
+<?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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <typeMapper >
+                        <mapperClassName>class</mapperClassName>
+                        <usePrimitives>false</usePrimitives>
+
+                        <type>
+                            <java>my.personal.type</java>
+                            <jdbc>varchar</jdbc>
+                        </type>
+                        <type>
+                            <java>java-01</java>
+                            <jdbc>jdbc-01</jdbc>
+                        </type>
+                        <type>
+                            <java>java-02</java>
+                            <jdbc>jdbc-02</jdbc>
+                            <length>21</length>
+                            <notNull>true</notNull>
+                        </type>
+                        <type>
+                            <java>java-03</java>
+                            <jdbc>jdbc-03</jdbc>
+                            <precision>5</precision>
+                            <scale>2</scale>
+                        </type>
+                        <type>
+                            <java>java-03</java>
+                            <jdbc>jdbc-03</jdbc>
+                            <precision>7</precision>
+                            <notNull>true</notNull>
+                        </type>
+                    </typeMapper>
+                </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/config/pom-schema-2.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.xml
new file mode 100644
index 0000000..05342fd
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema-2.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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    <dbimport>
+                        <schema>
+                            <name>NHL_STATS</name>
+                            <excludeTable>^ETL_.*</excludeTable>
+                            <excludeColumn>^ETL_.*</excludeColumn>
+                        </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/config/pom-schema.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema.xml
new file mode 100644
index 0000000..11804fc
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-schema.xml
@@ -0,0 +1,87 @@
+<?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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <schema>schema-name-01</schema>
+
+                        <schema>
+                            <name>schema-name-02</name>
+                        </schema>
+
+                        <schema>
+                            <name>schema-name-03</name>
+                            <includeTable>includeTable-01</includeTable>
+
+                            <includeTable>
+                                <pattern>includeTable-02</pattern>
+                            </includeTable>
+
+                            <includeTable>
+                                <pattern>includeTable-03</pattern>
+
+                                <includeColumn>includeColumn-01</includeColumn>
+                                <excludeColumn>excludeColumn-01</excludeColumn>
+                            </includeTable>
+
+                            <excludeTable>excludeTable-01</excludeTable>
+                            <excludeTable>
+                                <pattern>excludeTable-02</pattern>
+                            </excludeTable>
+                            <excludeTable>excludeTable-03</excludeTable>
+
+                            <includeColumn>includeColumn-01</includeColumn>
+                            <includeColumn>
+                                <pattern>includeColumn-02</pattern>
+                            </includeColumn>
+                            <includeColumn>includeColumn-03</includeColumn>
+                            <excludeColumn>excludeColumn-01</excludeColumn>
+                            <excludeColumn>
+                                <pattern>excludeColumn-02</pattern>
+                            </excludeColumn>
+                            <excludeColumn>excludeColumn-03</excludeColumn>
+
+                            
<includeProcedure>includeProcedure-01</includeProcedure>
+                            <includeProcedure>
+                                <pattern>includeProcedure-02</pattern>
+                            </includeProcedure>
+                            
<includeProcedure>includeProcedure-03</includeProcedure>
+                            
<excludeProcedure>excludeProcedure-01</excludeProcedure>
+                            <excludeProcedure>
+                                <pattern>excludeProcedure-02</pattern>
+                            </excludeProcedure>
+                            
<excludeProcedure>excludeProcedure-03</excludeProcedure>
+                        </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/config/pom-skip-primary-key-loading.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-primary-key-loading.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-primary-key-loading.xml
new file mode 100644
index 0000000..2c3e6c5
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-primary-key-loading.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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <skipPrimaryKeyLoading>true</skipPrimaryKeyLoading>
+                    </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/config/pom-skip-relationships-loading.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.xml
new file mode 100644
index 0000000..9291871
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-skip-relationships-loading.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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        
<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/config/pom-table-types.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-table-types.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-table-types.xml
new file mode 100644
index 0000000..b8d3ad3
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/config/pom-table-types.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";>
+
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-cayenne-plugin</artifactId>
+                <configuration>
+                    
<map>target/test/org/apache/cayenne/tools/dbimporter-map1.map.xml</map>
+
+                    <dbimport>
+                        <tableType>type1</tableType>
+                        <tableType>type2</tableType>
+                        <tableType>type3</tableType>
+                    </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/testComplexChangeOrder-pom.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder-pom.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder-pom.xml
new file mode 100644
index 0000000..6e09d8a
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder-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/testComplexChangeOrder.map.xml</map>
+                    <dataSource>
+                        <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                        
<url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    </dataSource>
+                    <dbimport>
+                        <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/testComplexChangeOrder.map.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml
new file mode 100644
index 0000000..20ccc69
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml
@@ -0,0 +1,64 @@
+<?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="ADDRESS" schema="SCHEMA_01">
+        <db-attribute name="addressString" type="VARCHAR" length="250"/>
+        <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
+    </db-entity>
+    <db-entity name="CHILD" schema="SCHEMA_01">
+        <db-attribute name="date" type="TIME"/>
+        <db-attribute name="id" type="INTEGER" length="10"/>
+        <db-attribute name="name" type="VARCHAR" length="30"/>
+        <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="Address" className="Address" dbEntityName="ADDRESS">
+        <obj-attribute name="addrStr" type="java.lang.String" 
db-attribute-path="addressString"/>
+    </obj-entity>
+    <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+        <obj-attribute name="id" type="java.lang.Integer" 
db-attribute-path="id"/>
+        <obj-attribute name="name" type="java.lang.String"/>
+    </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>
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/2cddff91/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml-result
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml-result
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml-result
new file mode 100644
index 0000000..d68faf1
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.map.xml-result
@@ -0,0 +1,53 @@
+<?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="ADDRESS" schema="SCHEMA_01">
+        <db-attribute name="ADDRSTR" type="VARCHAR" length="250"/>
+        <db-attribute name="id" type="INTEGER" isPrimaryKey="true" 
isMandatory="true"/>
+    </db-entity>
+    <db-entity name="CHILD" schema="SCHEMA_01">
+        <db-attribute name="ADDRESS_ID" type="INTEGER" length="10"/>
+        <db-attribute name="date" type="DATE" length="10" />
+        <db-attribute name="id" type="INTEGER" length="10"/>
+        <db-attribute name="name" type="VARCHAR" isMandatory="true" 
length="30" />
+        <db-attribute name="parent_id" type="INTEGER" length="10"/>
+    </db-entity>
+    <obj-entity name="Address" className="Address" dbEntityName="ADDRESS">
+        <obj-attribute name="addrstr" type="java.lang.String" 
db-attribute-path="ADDRSTR"/>
+    </obj-entity>
+    <obj-entity name="Child" className="Child" dbEntityName="CHILD">
+        <obj-attribute name="id" type="java.lang.Integer" 
db-attribute-path="id"/>
+        <obj-attribute name="name" type="java.lang.String"/>
+    </obj-entity>
+    <db-relationship name="children" source="ADDRESS" target="CHILD" 
toMany="true">
+        <db-attribute-pair source="id" target="ADDRESS_ID"/>
+    </db-relationship>
+    <db-relationship name="address" source="CHILD" target="ADDRESS" 
toMany="false">
+        <db-attribute-pair source="ADDRESS_ID" target="id"/>
+    </db-relationship>
+    <obj-relationship name="children" source="Address" target="Child" 
deleteRule="Deny" db-relationship-path="children"/>
+    <obj-relationship name="address" source="Child" target="Address" 
deleteRule="Nullify" db-relationship-path="address"/>
+
+</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/testComplexChangeOrder.sql
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.sql
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.sql
new file mode 100644
index 0000000..9885bc7
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testComplexChangeOrder.sql
@@ -0,0 +1,34 @@
+--  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.address (
+    addrStr VARCHAR (250),
+    id INTEGER  NOT NULL,
+    PRIMARY KEY (id)
+);
+
+CREATE TABLE schema_01.child (
+    address_id INTEGER ,
+    "date" DATE,
+    id INTEGER ,
+    name VARCHAR(30) NOT NULL,
+    parent_id INTEGER ,
+    CONSTRAINT fk_address FOREIGN KEY (address_id) REFERENCES 
schema_01.address (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/testCustomObjectLayerSettings-pom.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
new file mode 100644
index 0000000..8d31eaf
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings-pom.xml
@@ -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.
+  -->
+<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/testCustomObjectLayerSettings.map.xml
+                    </map>
+                    <dataSource>
+                        <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                        
<url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    </dataSource>
+                    <dbimport>
+                        <meaningfulPkTables>^*$</meaningfulPkTables>
+                        <usePrimitives>true</usePrimitives>
+                        <stripFromTableNames>^xyz_</stripFromTableNames>
+                        <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/testCustomObjectLayerSettings.map.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
new file mode 100644
index 0000000..acbc62c
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml
@@ -0,0 +1,30 @@
+<?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="EXISTING_TABLE" schema="SCHEMA_01">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="ExistingTable" className="ExistingTable" 
dbEntityName="EXISTING_TABLE">
+    </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/testCustomObjectLayerSettings.map.xml-result
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
new file mode 100644
index 0000000..9f36c0f
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.map.xml-result
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you under the Apache License, Version 2.0 (the
+       "License"); you may not use this file except in compliance
+       with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+       Unless required by applicable law or agreed to in writing,
+       software distributed under the License is distributed on an
+       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+       KIND, either express or implied.  See the License for the
+       specific language governing permissions and limitations
+       under the License.
+-->
+<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="EXISTING_TABLE" schema="SCHEMA_01">
+       <db-attribute name="COL2" type="INTEGER" length="10"/>
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="NEW_TABLE" schema="SCHEMA_01">
+       <db-attribute name="COL2" type="INTEGER" length="10"/>
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true" length="10"/>
+    </db-entity>
+    <db-entity name="XYZ_PREFIXED_NEW_TABLE" schema="SCHEMA_01">
+        <db-attribute name="ID" type="INTEGER" isPrimaryKey="true" 
isMandatory="true" length="10"/>
+    </db-entity>
+    <obj-entity name="ExistingTable" className="ExistingTable" 
dbEntityName="EXISTING_TABLE">
+        <obj-attribute name="col2" type="int" db-attribute-path="COL2"/>
+    </obj-entity>
+    <obj-entity name="NewTable" className="NewTable" dbEntityName="NEW_TABLE">
+        <obj-attribute name="col2" type="int" db-attribute-path="COL2"/>
+        <obj-attribute name="id" type="int" db-attribute-path="ID"/>
+    </obj-entity>
+    <obj-entity name="PrefixedNewTable" className="PrefixedNewTable" 
dbEntityName="XYZ_PREFIXED_NEW_TABLE">
+        <obj-attribute name="id" type="int" db-attribute-path="ID"/>
+    </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/testCustomObjectLayerSettings.sql
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.sql
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.sql
new file mode 100644
index 0000000..fe9ccd5
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testCustomObjectLayerSettings.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 SCHEMA schema_01;
+SET SCHEMA schema_01;
+
+CREATE TABLE schema_01.new_table (
+  id INTEGER NOT NULL,
+  COL2 INTEGER,
+  PRIMARY KEY (id)
+ );
+
+CREATE TABLE schema_01.existing_table (
+  id INTEGER NOT NULL,
+  COL2 INTEGER,
+  PRIMARY KEY (id)
+ );
+
+CREATE TABLE schema_01.xyz_prefixed_new_table (
+  id INTEGER NOT NULL,
+  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/testDbAttributeChange-pom.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange-pom.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange-pom.xml
new file mode 100644
index 0000000..ad0f98f
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange-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/testDbAttributeChange.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/testDbAttributeChange.map.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.map.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.map.xml
new file mode 100644
index 0000000..759090a
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.map.xml
@@ -0,0 +1,62 @@
+<?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="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>
+    <db-entity name="CHILD" schema="SCHEMA_01">
+        <db-attribute name="col1" type="INTEGER"/>
+        <db-attribute name="col2" 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>
+    <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>
+
+    <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/testDbAttributeChange.map.xml-result
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.map.xml-result
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.map.xml-result
new file mode 100644
index 0000000..c53bde2
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.map.xml-result
@@ -0,0 +1,62 @@
+<?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="COL3" type="DECIMAL" length="5" scale="1"/>
+        <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="col1" type="DOUBLE" length="52"/>
+        <db-attribute name="col2" type="CHAR" length="25"/>
+        <db-attribute name="parent_id" type="INTEGER" length="10"/>
+    </db-entity>
+    <db-entity name="parent" schema="SCHEMA_01">
+        <db-attribute name="COL2" type="CHAR" length="20"/>
+        <db-attribute name="COL3" type="DECIMAL" length="10" scale="2"/>
+        <db-attribute name="COL4" type="VARCHAR" length="50"/>
+        <db-attribute name="COL5" type="TIME" length="8"/>
+        <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>
+    <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/testDbAttributeChange.sql
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.sql
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.sql
new file mode 100644
index 0000000..c93c802
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDbAttributeChange.sql
@@ -0,0 +1,46 @@
+--  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(20),
+  COL3 DECIMAL(10,2),
+  COL4 VARCHAR(50),
+  COL5 TIME,
+
+  PRIMARY KEY (id),
+  UNIQUE (COL3)
+);
+
+CREATE TABLE schema_01.child (
+  id INTEGER NOT NULL,
+  parent_id INTEGER,
+  COL1 FLOAT,
+  COL2 CHAR(25),
+  COL3 DECIMAL(5,1),
+  COL4 VARCHAR(25),
+  COL5 DATE,
+
+  PRIMARY KEY (id)
+);
+
+ALTER TABLE schema_01.child
+    ADD FOREIGN KEY (parent_id)
+    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/testDefaultPackage-pom.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage-pom.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage-pom.xml
new file mode 100644
index 0000000..2a6828f
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage-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/testDefaultPackage.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>
+                        <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/testDefaultPackage.map.xml-result
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage.map.xml-result
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage.map.xml-result
new file mode 100644
index 0000000..5373617
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage.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="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="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/testDefaultPackage.sql
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage.sql
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage.sql
new file mode 100644
index 0000000..279065c
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testDefaultPackage.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/testFilteringWithSchema-pom.xml
----------------------------------------------------------------------
diff --git 
a/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema-pom.xml
 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema-pom.xml
new file mode 100644
index 0000000..de84543
--- /dev/null
+++ 
b/plugins/cayenne-maven-plugin/src/test/resources/org/apache/cayenne/tools/dbimport/testFilteringWithSchema-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/testFilteringWithSchema.map.xml</map>
+                    <dataSource>
+                        <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
+                        
<url>jdbc:derby:memory:DbImporterMojoTest;create=true</url>
+                    </dataSource>
+
+                    <dbimport>
+                        <schema>SCHEMA_01</schema>
+                    </dbimport>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

Reply via email to