You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by sk...@apache.org on 2016/12/06 13:16:28 UTC

[1/5] cayenne git commit: Reverse Engineering Tutorial

Repository: cayenne
Updated Branches:
  refs/heads/master ca0ef2824 -> 71f994478


Reverse Engineering Tutorial


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/ed2f6c03
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/ed2f6c03
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/ed2f6c03

Branch: refs/heads/master
Commit: ed2f6c038e540cec5dd47009a414a79d13caf2af
Parents: c614691
Author: Savva Kolbachev <s....@gmail.com>
Authored: Wed Aug 17 11:31:01 2016 +0300
Committer: Savva Kolbachev <s....@gmail.com>
Committed: Wed Aug 17 11:31:01 2016 +0300

----------------------------------------------------------------------
 .../getting-started-reverse-engineering/pom.xml |  41 +++
 .../src/docbkx/index.xml                        |  42 +++
 .../src/docbkx/reverse-engineering-ch1.xml      | 322 +++++++++++++++++++
 .../src/docbkx/reverse-engineering-ch2.xml      | 218 +++++++++++++
 .../images/customer-order-ordered_product.png   | Bin 0 -> 29330 bytes
 .../src/images/customer-order.png               | Bin 0 -> 16562 bytes
 .../src/images/customer1.png                    | Bin 0 -> 9652 bytes
 .../src/images/customer2.png                    | Bin 0 -> 11504 bytes
 docs/docbook/pom.xml                            |   1 +
 9 files changed, 624 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/pom.xml b/docs/docbook/getting-started-reverse-engineering/pom.xml
new file mode 100644
index 0000000..69209f4
--- /dev/null
+++ b/docs/docbook/getting-started-reverse-engineering/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.cayenne.docs</groupId>
+        <artifactId>cayenne-docbook</artifactId>
+        <version>4.0.M4-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>getting-started-reverse-engineering</artifactId>
+
+    <packaging>jar</packaging>
+    <name>Docbook: Getting Started with Cayenne RE</name>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>target/site</directory>
+            </resource>
+        </resources>
+    </build>
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
new file mode 100644
index 0000000..38dafb0
--- /dev/null
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+<book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+    xml:id="getting-started-reverse-engineering" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <info>
+        <title>Getting Started with Cayenne Reverse Engineering</title>
+        <copyright>
+            <year>2011-2014</year>
+            <holder>Apache Software Foundation and individual authors</holder>
+        </copyright>
+        <legalnotice>
+            <title>License</title>
+            <para>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</para>
+            
+            <para>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.</para>
+        </legalnotice>
+    </info>
+    <xi:include href="reverse-engineering-ch1.xml"/>
+    <xi:include href="reverse-engineering-ch2.xml"/>
+</book>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
new file mode 100644
index 0000000..454e91b
--- /dev/null
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
@@ -0,0 +1,322 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+    <title>Introduction and Basic Usage</title>
+    <section xml:id="introduction">
+        <title>Introduction</title>
+        <para>In Java development there is a well known problem about synchronization Java domain
+            model and relationship model in database. Let\u2019s assume you are working on one of
+            a shopping application, some of your domain model classes would be Product, Order,
+            Shopping Cart and Customer. Considering the above sentence, we have a Java class and database
+            table name called \u201cCustomer\u201d.</para>
+        <para>Java Class:</para>
+        <programlisting language="java">
+            public class Customer {
+
+                private int id;
+                private String name;
+
+                public Customer(){
+                    // to do your instance initialization stuff here
+                }
+
+                public  Customer(int id,String name){
+                    this.id = id;
+                    this.name = name;
+                }
+
+                // getter and setter method goes here
+
+            }
+        </programlisting>
+        <para>Database:</para>
+        <programlisting language="sql">
+            CREATE TABLE `customer` (
+            `id` INT(11) NOT NULL,
+            `name` VARCHAR(45) DEFAULT NULL,
+            PRIMARY KEY (`id`));
+        </programlisting>
+        <para>
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata fileref="images/customer1.png" scalefit="1" width="100%"/>
+                </imageobject>
+            </inlinemediaobject>
+        </para>
+
+        <para>Let\u2019s assume you have to split Customer model \u201cname\u201d field as First name and Last Name
+            due to the client requirement. In that case you have to update both Java class and table model manually.
+        </para>
+        <para>Java Class:</para>
+        <programlisting language="java">
+            public class Customer {
+
+                private int id;
+                private String firstname;
+                private String lastname;
+                public Customer(){
+                    // to do your instance initialization stuff here
+                }
+
+                public  Customer(int id,String fname,String lname){
+                    this.id = id;
+                    this.firstname = fname;
+                    this.lastname = lname;
+                }
+
+                // getter and setter method goes here
+            }
+        </programlisting>
+        <para>Database:</para>
+        <programlisting language="sql">
+            CREATE TABLE `customer` (
+            `id` INT(11) NOT NULL,
+            `firstname` VARCHAR(45) DEFAULT NULL,
+            `lastname` VARCHAR(45) DEFAULT NULL,
+            PRIMARY KEY (`id`));
+        </programlisting>
+        <para>
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata fileref="images/customer2.png" scalefit="1" width="100%"/>
+                </imageobject>
+            </inlinemediaobject>
+        </para>
+        <para>
+            In the above example, synchronization of domain model and database relationship model is manually
+            updated by Java developers. In this situation we have to keep both copies of Java classes and
+            database tables up to date manually. If you change something in db, that changes should be reflected
+            in Java classes. Likewise all Java classes changes should be reflected in database.
+            Although it can be automated manually, it will take some cost of time.
+        </para>
+        <para>
+            However, Cayenne automates this process with a minimum cost of time. It has two options for this automation process:
+            <itemizedlist>
+                <listitem>
+                    <para>Forward Engineering  - Generating db schema according to the Java classes.</para>
+                </listitem>
+            </itemizedlist>
+            <itemizedlist>
+                <listitem>
+                    <para>Reverse Engineering - Updating Java classes according to the database schema.</para>
+                </listitem>
+            </itemizedlist>
+
+            The reverse engineering tool is called CDBImport.
+        </para>
+    </section>
+    <section xml:id="basic-usage">
+        <title>Basic Usage</title>
+        <para>
+            CDBImport is a Maven plugin that helps you to do reverse engineering. In other words it helps you to synchronize
+            database structure with your Cayenne mapping config. It does not update Java classes by itself, but it synchronizes db
+            and data access layer representation in Cayenne mapping file with actual database state.
+            Most common practice to complete reverse engineering is to use CGen Maven plugin after CDBImport,
+            which does class generation according to the Cayenne mapping file updates.
+        </para>
+        <para>
+            You could use CDBImport Maven plugin by declaring and configuring it in your pom.xml.
+            See an example with comments below:
+        </para>
+        <programlisting language="xml">
+            &lt;profile&gt;
+                &lt;!-- Here we define a profile with cdbimport and cgen configurations.
+                For sure you could define all plugins in general build section, but it will be time consuming
+                during each build to load database structure and check it for changes. Also, you will probably want to
+                control when exactly reverse engineering happens in order to correct its results if necessary. --&gt;
+                &lt;id>ormsync&lt;/id&gt;
+                &lt;build&gt;
+                    &lt;plugins&gt;
+                        &lt;plugin&gt;
+                            &lt;groupId&gt;org.apache.cayenne.plugins&lt;/groupId&gt;
+                            &lt;artifactId&gt;maven-cayenne-plugin&lt;/artifactId&gt;
+                            &lt;version&gt;4.0.M3&lt;/version&gt;
+                            &lt;executions&gt;
+                                &lt;execution&gt;
+                                    &lt;id&gt;ormsync&lt;/id&gt;
+                                    &lt;goals&gt;
+                                        &lt;!-- Again, cdbimport is a part of reverse engineering process.
+                                        Next step is generating Java classes according to their mapping by cgen. --&gt;
+                                        &lt;goal&gt;cdbimport&lt;/goal&gt;
+                                        &lt;goal&gt;cgen&lt;/goal&gt;
+                                    &lt;/goals&gt;
+                                    &lt;configuration&gt;
+                                        &lt;!-- At first, we have to define database connection information
+                                        from which the structure will be loaded. --&gt;
+                                        &lt;driver&gt;com.mysql.jdbc.Driver&lt;/driver&gt;
+                                        &lt;url&gt;jdbc:mysql://127.0.0.1:3306/test&lt;/url&gt;
+                                        &lt;username&gt;root&lt;/username&gt;
+                                        &lt;!--&lt;password&gt;password&lt;/password&gt;--&gt;
+                                        &lt;!-- Next step is to define mapping file, which we are going to use.
+                                        If it doesn't exist, it will be created automatically after the first plugin execution.
+                                        Here you could also define some mapping properties. It isn't necessary for cdbimport task, but it will be used by cgen. --&gt;
+                                        &lt;map&gt;${project.basedir}/src/main/resources/shopping.map.xml&lt;/map&gt;
+                                        &lt;defaultPackage&gt;org.apache.cayenne.shopping&lt;/defaultPackage&gt;
+                                        &lt;superPkg&gt;org.apache.cayenne.shopping.auto&lt;/superPkg&gt;
+                                        &lt;!-- Last part of configuration is reverse engineering tuning.
+                                        Here we just define which catalogs we want to process and which tables should be excluded.
+                                        You could find detailed description of possible configurations in the documentation. --&gt;
+                                        &lt;catalog&gt;test&lt;/catalog&gt;
+                                        &lt;excludeTables&gt;system_patch,v_*,*_view&lt;/excludeTables&gt;
+                                    &lt;/configuration&gt;
+                                &lt;/execution&gt;
+                            &lt;/executions&gt;
+                            &lt;dependencies&gt;
+                                &lt;!-- Also, you have to add JDBC driver dependency. --&gt;
+                                &lt;dependency&gt;
+                                    &lt;groupId&gt;mysql&lt;/groupId&gt;
+                                    &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
+                                    &lt;version&gt;5.1.28&lt;/version&gt;
+                                &lt;/dependency&gt;
+                            &lt;/dependencies&gt;
+                        &lt;/plugin&gt;
+                    &lt;/plugins&gt;
+                &lt;/build&gt;
+            &lt;/profile&gt;
+        </programlisting>
+        <para>
+            Let\u2019s consider that shopping application consists of the following tables and relationships in database.
+            Initially, we are going to take customer, order tables and one foreign key relationship between them.
+        </para>
+        <para>SQL</para>
+        <programlisting language="sql">
+            CREATE TABLE `customer` (
+            `id` INT(11) NOT NULL,
+            `name` VARCHAR(50) DEFAULT NULL,
+            PRIMARY KEY (`id`));
+
+            CREATE TABLE `order` (
+            `id` INT(11) NOT NULL,
+            `amount` DECIMAL(6,2) DEFAULT NULL,
+            `customer_id` INT(11) DEFAULT NULL,
+            PRIMARY KEY (`id`),
+            KEY `fk_customers_id_idx` (`customer_id`),
+            CONSTRAINT `fk_customers_id_refference` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`)
+            ON DELETE CASCADE ON UPDATE CASCADE);
+        </programlisting>
+        <para>
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata fileref="images/customer-order.png" scalefit="1" width="100%"/>
+                </imageobject>
+            </inlinemediaobject>
+        </para>
+        <para>
+            Now, please arrange the profile above for your custom DB settings. That\u2019s all you need to do for reverse
+            engineering with Cayenne. Now you are able to run the reverse engineering task as described below.
+        </para>
+        <programlisting>
+            mvn compile -Pormsync
+        </programlisting>
+        <para>The output should look like this:</para>
+        <programlisting>
+            [INFO] Scanning for projects...
+            [INFO]
+            [INFO] ------------------------------------------------------------------------
+            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
+            [INFO] ------------------------------------------------------------------------
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.access.DbLoader load
+            INFO: Schema loading...
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 3:36:41 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            [INFO]   Table: test.customer
+            [INFO]   Table: test.order
+            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+            [INFO]
+            [INFO] Map file does not exist. Loaded db model will be saved into '**/MySQLTest/src/main/resources/shopping.map.xml'
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+            [INFO] Generating class file:**/MySQLTest/src/main/java/org/apache/cayenne/shopping/Customer.java
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+            [INFO] Generating class file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/Order.java
+            [INFO]
+        </programlisting>
+        <para>
+            Above output demonstrates what was loaded from database (test.order, test.customer tables and customer_id relationships)
+            by cdbimport task and which classes was generated by cgen task.
+        </para>
+        <para>
+            In the example we assume that you don't have a mapping file. But if you have, it will contain the relationship between
+            Java class and database table. Note that if there is no mapping file, Cayenne will generate it automatically and store it
+            under the resource folder specified by &lt;map&gt; property.
+        </para>
+
+        <para>
+            Notice that cdbimport updates only one file in your source code: mapping file that you pointed in &lt;map&gt; maven option.
+            If you do reverse engineering again (mvn compile -Pormsync), plug-in will load all information from database but say that
+            no changes are detected. On the other hand, cgen task will regenerate superclasses (_Customer.java, _Order.java),
+            but not subclasses (Customer.java, Order.java).
+        </para>
+        <para>Console will provide the following output:</para>
+        <programlisting>
+            [INFO] Scanning for projects...
+            [INFO]
+            [INFO] ------------------------------------------------------------------------
+            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
+            [INFO] ------------------------------------------------------------------------
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.access.DbLoader load
+            INFO: Schema loading...
+            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 4:44:34 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 4:44:34 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            [INFO]   Table: test.customer
+            [INFO]   Table: test.order
+            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+            [INFO]
+            [INFO] Detected changes: No changes to import.
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+            [INFO]
+        </programlisting>
+    </section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
new file mode 100644
index 0000000..2a48924
--- /dev/null
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
@@ -0,0 +1,218 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0">
+    <title>A few hands-on examples</title>
+    <section xml:id="renaming-table-column-example">
+        <title>Renaming table column example</title>
+        <para>
+            Let's rename "name" column from the Customer table to the "first_name".
+        </para>
+        <para>
+            SQL
+        </para>
+        <programlisting>
+            ALTER TABLE `customer` 
+            CHANGE COLUMN `name` `first_name` VARCHAR(50) NULL DEFAULT NULL ;
+        </programlisting>
+        <para>
+            Now we can do reverse engineering again by the command we already know:
+        </para>
+        <programlisting>
+            mvn compile -Pormsync
+        </programlisting>
+        <para>The output should look like this:</para>
+        <programlisting>
+            [INFO] Scanning for projects...
+            [INFO]
+            [INFO] ------------------------------------------------------------------------
+            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
+            [INFO] ------------------------------------------------------------------------
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+            Aug 16, 2016 5:07:31 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.access.DbLoader load
+            INFO: Schema loading...
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:07:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            [INFO]   Table: test.customer
+            [INFO]   Table: test.order
+            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+            [INFO]
+            [INFO] Detected changes:
+            [INFO]     Add Column           customer.first_name
+            [INFO]     Drop Column          customer.name
+            [INFO]
+            [INFO] Migration Complete Successfully.
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+            [INFO]
+        </programlisting>
+        <para>
+            As you could see, cdbimport task found and applied our changes to the model. Then, superclasses was updated by 
+            cgen task to catch our changes. Notice that Cayenne treated a column renaming change as dropping and adding 
+            a new column, because it can\u2019t really track the renaming change.
+        </para>
+    </section>
+    <section xml:id="renaming-objattribute-example">
+        <title>Renaming ObjAttribute example</title>
+        <para>
+            Let\u2019s rename an "amount" ObjAttribute name to "totalPrice" in Order ObjectEntity. After running
+            reverse engineering task, the output will show you no changes to import:
+        </para>
+        <programlisting>
+            [INFO] Scanning for projects...
+            [INFO]
+            [INFO] ------------------------------------------------------------------------
+            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
+            [INFO] ------------------------------------------------------------------------
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.access.DbLoader load
+            INFO: Schema loading...
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:26:53 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            [INFO]   Table: test.customer
+            [INFO]   Table: test.order
+            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+            [INFO]
+            [INFO] Detected changes: No changes to import.
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+            [INFO]
+        </programlisting>
+        <para>
+            As you could see, cdbimport task didn't detect any changes. Whenever you change anything in \u201cobj-attribute\u201d xml element 
+            it will not reflect anything on the database side. But your changes will be reflected in auto generated java classes
+            by cgen task.
+        </para>
+    </section>
+    <section xml:id="adding-table-relationships-example">
+        <title>Adding table and relationships example</title>
+        <para>
+            In this section we are going to add a new table "ordered_product" with foreign key relationships between the existing tables.
+            So our schema will look as follows:
+        </para>
+        <para>
+            SQL
+        </para>
+        <programlisting language="sql">
+            CREATE TABLE `ordered_product` (
+            `customer_order_id` INT(11) NOT NULL,
+            `product_id` INT(11) DEFAULT NULL,
+            `quantity` SMALLINT(6) DEFAULT NULL,
+            PRIMARY KEY (`customer_order_id`),
+            KEY `fk_product_references_idx` (`product_id`),
+            CONSTRAINT `fk_order_references` FOREIGN KEY (`customer_order_id`) REFERENCES `order` (`id`) 
+            ON DELETE CASCADE ON UPDATE CASCADE);
+        </programlisting>
+        <para>
+            <inlinemediaobject>
+                <imageobject>
+                    <imagedata fileref="images/customer-order-ordered_product.png" scalefit="1" width="100%"/>
+                </imageobject>
+            </inlinemediaobject>
+        </para>
+        <para>
+            After running the reverse engineering task again as described in the previous examples, the new output will 
+            show a few actual DB operations:
+        </para>
+        <programlisting>
+            [INFO] Scanning for projects...
+            [INFO]
+            [INFO] ------------------------------------------------------------------------
+            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
+            [INFO] ------------------------------------------------------------------------
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.access.DbLoader load
+            INFO: Schema loading...
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+            INFO: +++ Connecting: SUCCESS.
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+            [INFO]   Table: test.customer
+            [INFO]   Table: test.order
+            [INFO]   Table: test.ordered_product
+            [INFO]     Db Relationship : toOne  (ordered_product.customer_order_id, order.id)
+            [INFO]     Db Relationship : toOne  (order.id, ordered_product.customer_order_id)
+            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+            [INFO]
+            [INFO] Detected changes:
+            [INFO]     Add Relationship     customerOrder order->ordered_product.customer_order_id
+            [INFO]     Create Table         ordered_product
+            [INFO]
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.util.EntityMergeSupport addMissingRelationships
+            WARNING: Can't find ObjEntity for ordered_product
+            Aug 16, 2016 5:43:52 PM org.apache.cayenne.util.EntityMergeSupport addMissingRelationships
+            WARNING: Db Relationship (Db Relationship : toOne  (order.id, ordered_product.customer_order_id)) will have GUESSED Obj Relationship reflection.
+            [INFO] Migration Complete Successfully.
+            [INFO]
+            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_OrderedProduct.java
+            [INFO] Generating class file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/OrderedProduct.java
+            [INFO]
+        </programlisting>
+    </section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/images/customer-order-ordered_product.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/images/customer-order-ordered_product.png b/docs/docbook/getting-started-reverse-engineering/src/images/customer-order-ordered_product.png
new file mode 100644
index 0000000..d471065
Binary files /dev/null and b/docs/docbook/getting-started-reverse-engineering/src/images/customer-order-ordered_product.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/images/customer-order.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/images/customer-order.png b/docs/docbook/getting-started-reverse-engineering/src/images/customer-order.png
new file mode 100644
index 0000000..1aef34e
Binary files /dev/null and b/docs/docbook/getting-started-reverse-engineering/src/images/customer-order.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/images/customer1.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/images/customer1.png b/docs/docbook/getting-started-reverse-engineering/src/images/customer1.png
new file mode 100644
index 0000000..777ef19
Binary files /dev/null and b/docs/docbook/getting-started-reverse-engineering/src/images/customer1.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/getting-started-reverse-engineering/src/images/customer2.png
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/images/customer2.png b/docs/docbook/getting-started-reverse-engineering/src/images/customer2.png
new file mode 100644
index 0000000..5c535fb
Binary files /dev/null and b/docs/docbook/getting-started-reverse-engineering/src/images/customer2.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/ed2f6c03/docs/docbook/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/pom.xml b/docs/docbook/pom.xml
index 5227396..6d3bf9e 100644
--- a/docs/docbook/pom.xml
+++ b/docs/docbook/pom.xml
@@ -34,6 +34,7 @@
 		<module>cayenne-guide</module>
 		<module>getting-started</module>
 		<module>getting-started-rop</module>
+        <module>getting-started-reverse-engineering</module>
 		<module>upgrade-guide</module>
     </modules>
 


[3/5] cayenne git commit: Cayenne documentation update - added Modeler reverse engineering tool description - docbook maven plugin updated - all docs updated to proper syntax highlight - css style added for console input/output elements ( tag

Posted by sk...@apache.org.
http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-modeler.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-modeler.xml b/docs/docbook/cayenne-guide/src/docbkx/re-modeler.xml
new file mode 100644
index 0000000..017c455
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-modeler.xml
@@ -0,0 +1,113 @@
+<?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.
+-->
+<chapter version="5.0" xml:id="re-modeler" xmlns="http://docbook.org/ns/docbook"
+         xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ns="http://docbook.org/ns/docbook">
+    <title>Reverse Engineering in Cayenne Modeler</title>
+
+    <para>
+        Alternative aproach to using <link linkend="what-is-cdbimport">cdbimport </link> is doing reverse engineering
+        from <link linkend="running-cayennemodeler">Cayenne Modeler</link>. Currently modeler GUI doesn't support
+        all features of ant/maven tasks but it suffice for general DB import.
+        Especially it's a good place to quickly start working on your data model.
+    </para>
+
+    <para>
+        You can find reverse engineering tool in main modeler menu
+        <emphasis role="strong">
+            <guimenu>Tools</guimenu> &gt; <guimenuitem>Reengineer Database Schema</guimenuitem>
+        </emphasis>
+    </para>
+
+    <section xml:id="modeler-re-datasource">
+        <title>DataSource selection</title>
+        <para>First you should select DataSource. If you don't have any DataSource
+            yet you can create one from this menu.
+            <mediaobject>
+                <imageobject condition="web">
+                    <imagedata fileref="images/re-modeler-datasource-select.png"
+                               format="PNG" scale="70"/>
+                </imageobject>
+
+                <textobject>
+                    <phrase>Datasource selection dialog</phrase>
+                </textobject>
+
+                <caption>
+                    <para>Datasource selection dialog.</para>
+                </caption>
+            </mediaobject>
+        </para>
+    </section>
+
+    <section xml:id="modeler-re-options">
+        <title>Reverse engineering options</title>
+        <para>Once DataSource is selected you can proceed to reverse engineering
+            options.
+            <mediaobject>
+                <imageobject condition="web">
+                    <imagedata fileref="images/re-modeler-reverseengineering-dialog.png"
+                               format="PNG" scale="70"/>
+                </imageobject>
+
+                <textobject>
+                    <phrase>Reverse Engineering dialog</phrase>
+                </textobject>
+
+                <caption>
+                    <para>Reverse Engineering dialog.</para>
+                </caption>
+            </mediaobject>
+        </para>
+
+        <para>
+            Here is a list of options to tune what will be processed by reverse engineering:
+            <itemizedlist>
+                <listitem>
+                    <para><emphasis role="strong">Select Catalog</emphasis>:
+                        catalog to process
+                        <note>
+                            <para>You can only select one catalog. If you need to import multiple catalogs you need to run process several times.</para>
+                        </note>
+                    </para>
+                </listitem>
+
+                <listitem>
+                    <para><emphasis role="strong">Table Name Pattern</emphasis>:
+                        RegExp to filter tables. Default pattern <code>.*</code> includes all tables.
+                    </para>
+                </listitem>
+                <listitem>
+                    <para><emphasis role="strong">Procedure Name Pattern</emphasis>:
+                        RegExp to filter procedures. Default pattern <code>.*</code> includes all stored procedures.
+                    </para>
+                </listitem>
+                <listitem>
+                    <para><emphasis role="strong">Naming Strategy</emphasis>:
+                        Currently there is only one naming strategy available.
+                        See ant/maven tools <link linkend="re-name-generator">documentation</link> for details about naming strategy.
+                    </para>
+                </listitem>
+                <listitem>
+                    <para><emphasis role="strong">Tables with Meaningful PK Pattern</emphasis>:
+                        Comma separated list of RegExp's for tables that you want to have meaningful primary keys.
+                        By default no meaningful PKs are created.
+                    </para>
+                </listitem>
+            </itemizedlist>
+        </para>
+    </section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml b/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
index e89ebfa..34824b6 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
@@ -38,13 +38,15 @@
                 </listitem>
             </itemizedlist>
         </para>
-        <table>
-            <tbody>
+        <table frame="void">
+            <thead>
                 <tr>
-                    <td>OneToMany</td>
-                    <td>Implicit</td>
-                    <td>Explicit</td>
+                    <th>OneToMany</th>
+                    <th>Implicit</th>
+                    <th>Explicit</th>
                 </tr>
+            </thead>
+            <tbody>
                 <tr>
                     <td>ARTIST.ARTIST_ID -- PAINTING.ARTIST_ID</td>
                     <td>Artists.paintings</td>
@@ -67,7 +69,11 @@
         <title>Cuztomizing Name Generator</title>
         <para>
             In case you want to customize the default naming strategy, you could set your own strategy through the namingStrategy option in the Maven or Ant 
-            configuration. Ensure that naming strategy class is in a class-path and implements ObjectNameGenerator interface.
+            configuration. Ensure that naming strategy class is in a class-path and implements <code>org.apache.cayenne.dbsync.naming.ObjectNameGenerator</code> interface.
+            <programlisting language="xml">
+    &lt;reverseEngineering&gt;
+        &lt;namingStrategy&gt;YourCustomNameGenerator&lt;/namingStrategy&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
         </para>
     </section>
 </chapter>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml b/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
index bc0bc23..9007cab 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
@@ -64,7 +64,7 @@
     <section xml:id="many-to-many">
         <title>ManyToMany</title>
         <para>
-            This type of relationships usually modeled via join or junction table (http://en.wikipedia.org/wiki/Junction_table).
+            This type of relationships usually modeled via join or junction table (<link xlink:href="http://en.wikipedia.org/wiki/Junction_table">http://en.wikipedia.org/wiki/Junction_table</link>).
             It is also successfully handled by cdbimport. Notice that join table should contain two and only two columns. Both of this columns 
             should be included as primary keys. 
         </para>
@@ -72,24 +72,22 @@
     <section xml:id="skip-relationships-loading">
         <title>Skip Relationships Loading</title>
         <para>
-            You are able to skip relationships loading by the &lt;skipRelationshipsLoading&gt; element.
+            You are able to skip relationships loading by the <code language="xml">&lt;skipRelationshipsLoading&gt;</code> element.
         </para>
         <programlisting language="xml">
-            &lt;reverseEngineering&gt;
-                &lt;skipRelationshipsLoading&gt;true&lt;skipRelationshipsLoading&gt;
-            &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+        &lt;skipRelationshipsLoading&gt;true&lt;skipRelationshipsLoading&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
     </section>
     <section xml:id="skip-pk-loading">
         <title>Skip Primary Keys Loading</title>
         <para>
-            Another useful Cayenne reverse engineering property is &lt;skipPrimaryKeyLoading&gt;. If you decide to support all relationships at the application layer
+            Another useful Cayenne reverse engineering property is <code language="xml">&lt;skipPrimaryKeyLoading&gt;</code>. If you decide to support all relationships at the application layer
             and avoid their management in database, you\u2019ll find useful to turn off primary keys synchronization at all.
         </para>
         <programlisting language="xml">
-            &lt;reverseEngineering&gt;
-                &lt;skipPrimaryKeyLoading&gt;true&lt;skipPrimaryKeyLoading&gt;
-            &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+        &lt;skipPrimaryKeyLoading&gt;true&lt;skipPrimaryKeyLoading&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml b/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
index 55403fe..6df6179 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
@@ -19,24 +19,22 @@
     <title>Table Types</title>
     <para>
         By default, cdbimport processes only tables and views from schema, but there are a lot of other objects that could be loaded from database,
-        such as SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM, etc. Those things are specific for concrete databases and could be accepted
-        by the &lt;tableType&gt;&lt;tableType&gt; element.
+        such as <code>SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM</code>, etc. Those things are specific for concrete databases and could be accepted
+        by the <code language="xml">&lt;tableType&gt;&lt;/tableType&gt;</code> element.
     </para>
     <para>
         Import only tables
         <programlisting language="xml">
-                &lt;reverseEngineering>&gt;
-                    &lt;tableType&gt;TABLE&lt;/tableType&gt;
-                &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+        &lt;tableType&gt;TABLE&lt;/tableType&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
     </para>
     <para>
-        Tables and views (default option)
+        Tables and views (<emphasis>default option</emphasis>)
         <programlisting language="xml">
-                &lt;reverseEngineering>&gt;
-                    &lt;tableType&gt;TABLE&lt;/tableType&gt;
-                    &lt;tableType&gt;VIEWS&lt;/tableType&gt;
-                &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+        &lt;tableType&gt;TABLE&lt;/tableType&gt;
+        &lt;tableType&gt;VIEWS&lt;/tableType&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
     </para>
 </chapter>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml b/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
index 274c4ec..e99146a 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
@@ -18,60 +18,60 @@
     version="5.0" xml:id="re-types-mapping">
     <title>Types Mapping</title>
     <para>
-        Types mapping is a process of mapping between Database types and Java Classes through JDBC types that are represented by java.sql.Types.
+        Types mapping is a process of mapping between Database types and Java Classes through JDBC types that are represented by <code>java.sql.Types</code>.
     </para>
     <para>
-        By default, java.sql.Types will be mapped to Java built in types or wrapper class types. Actually, Cayenne allows you to override the default mapping.
-        You could use the &lt;typeMapper&gt; configuration section to customize how JDBC types should be identified in database and how they should be
+        By default, <code>java.sql.Types</code> will be mapped to Java built in types or wrapper class types. Actually, Cayenne allows you to override the default mapping.
+        You could use the <code>&lt;typeMapper&gt;</code> configuration section to customize how JDBC types should be identified in database and how they should be
         mapped to Java Classes during reverse engineering process.
     </para>
     <para>
-        Sometimes you need to map database types to your custom Java Classes. If you really want to do this, then you should implement 
-        org.apache.cayenne.access.types.ExtendedType interface for your classes.
+        Sometimes you need to map database types to your custom Java Classes. If you really want to do this, then you should implement
+        <code>org.apache.cayenne.access.types.ExtendedType</code> interface for your classes.
     </para>
     <section xml:id="basic-configuration">
         <title>Basic Configuration</title>
         <para>Here is an example of a basic typeMapper configuration:</para>
         <programlisting language="xml">
-                &lt;reverseEngineering&gt;
-                    &lt;typeMapper&gt;
-                        &lt;mapperClassName&gt;class&lt;/mapperClassName&gt;
-                        &lt;usePrimitives&gt;false&lt;/usePrimitives&gt;
-                        &lt;type&gt;
-                            &lt;!-- Java type names--&gt;
-                            &lt;java&gt;java.math.BigDecimal&lt;/java&gt;
-                            &lt;!-- JDBC tag is name for java.sql.Types --&gt;
-                            &lt;jdbc&gt;DECIMAL&lt;/jdbc&gt;
-                            &lt;!-- Length, scale and precision can be used to specify the mapping precisely --&gt;
-                            &lt;precision&gt;16&lt;/precision&gt;
-                            &lt;scale&gt;2&lt;/scale&gt;
-                        &lt;/type&gt;
-                        &lt;type&gt;
-                            &lt;java&gt;java.lang.Long&lt;/java&gt;
-                            &lt;jdbc&gt;NUMERIC&lt;/jdbc&gt;
-                        &lt;/type&gt;
-                        &lt;type&gt;
-                            &lt;java&gt;java.lang.String&lt;/java&gt;
-                            &lt;jdbc&gt;VARCHAR&lt;/jdbc&gt;
-                            &lt;length&gt;100&lt;/length&gt;
-                            &lt;notNull&gt;true&lt;/notNull&gt;
-                        &lt;/type&gt;
-                        &lt;type&gt;
-                            &lt;java&gt;java.util.Date&lt;/java&gt;
-                            &lt;jdbc&gt;TIMESTAMP&lt;/jdbc&gt;
-                        &lt;/type&gt;
-                    &lt;/typeMapper&gt;
-                &lt;/reverseEngineering&gt;
+    &lt;reverseEngineering&gt;
+        &lt;typeMapper&gt;
+            &lt;mapperClassName&gt;CustomMapperClass&lt;/mapperClassName&gt;
+            &lt;usePrimitives&gt;false&lt;/usePrimitives&gt;
+            &lt;type&gt;
+                &lt;!-- Java type names--&gt;
+                &lt;java&gt;java.math.BigDecimal&lt;/java&gt;
+                &lt;!-- JDBC tag is name for java.sql.Types --&gt;
+                &lt;jdbc&gt;DECIMAL&lt;/jdbc&gt;
+                &lt;!-- Length, scale and precision can be used to specify the mapping precisely --&gt;
+                &lt;precision&gt;16&lt;/precision&gt;
+                &lt;scale&gt;2&lt;/scale&gt;
+            &lt;/type&gt;
+            &lt;type&gt;
+                &lt;java&gt;java.lang.Long&lt;/java&gt;
+                &lt;jdbc&gt;NUMERIC&lt;/jdbc&gt;
+            &lt;/type&gt;
+            &lt;type&gt;
+                &lt;java&gt;java.lang.String&lt;/java&gt;
+                &lt;jdbc&gt;VARCHAR&lt;/jdbc&gt;
+                &lt;length&gt;100&lt;/length&gt;
+                &lt;notNull&gt;true&lt;/notNull&gt;
+            &lt;/type&gt;
+            &lt;type&gt;
+                &lt;java&gt;java.util.Date&lt;/java&gt;
+                &lt;jdbc&gt;TIMESTAMP&lt;/jdbc&gt;
+            &lt;/type&gt;
+        &lt;/typeMapper&gt;
+    &lt;/reverseEngineering&gt;
         </programlisting>
         <itemizedlist>
             <listitem>
                 <para>
-                    &lt;mapperClassName&gt; - name of the fully qualified custom Java mapper class.
+                    <code>&lt;mapperClassName&gt;</code> - name of the fully qualified custom Java mapper class.
                 </para>
             </listitem>
             <listitem>
                 <para>
-                    &lt;usePrimitives&gt; -  allows you to make a decision whether to use primitives or not. It's quite useful, because primitives are faster than objects.
+                    <code>&lt;usePrimitives&gt;</code> -  allows you to make a decision whether to use primitives or not. It's quite useful, because primitives are faster than objects.
                     If you want to use primitive type instead of wrapper type just set this option to true, otherwise false. It is more intuitive and has less overhead.
                     If it is not possible because generics/autoboxing reasons, or if you want it to be nullable, then use the wrapper type. All the wrapper classes
                     (Integer, Long, Byte, Double, Float, Short) are subclasses of the abstract class Number. The object of the wrapper class contains/wraps them respectively
@@ -81,42 +81,40 @@
             </listitem>
             <listitem>
                 <para>
-                    &lt;java&gt; - name of the fully qualified Java class for mapping. If the class is a primitive wrapper class such as java.lang.Integer, 
+                    <code>&lt;java&gt;</code> - name of the fully qualified Java class for mapping. If the class is a primitive wrapper class such as java.lang.Integer,
                     the mapping also applies to the primitive type.
                 </para>
             </listitem>
             <listitem>
                 <para>
-                    &lt;jdbc&gt; -  JDBC type which will be used by JDBC PreparedStatement, SQL Queries and for loading data from JDBC ResultSet. 
+                    <code>&lt;jdbc&gt;</code> -  JDBC type which will be used by JDBC PreparedStatement, SQL Queries and for loading data from JDBC ResultSet.
                     The valid types are defined in java.sql.Types.
                 </para>
             </listitem>
             <listitem>
                 <para>
-                    &lt;notNull&gt; - It's not a conditional constraint. Either your mapping are always required, in which case you should specify them as notNull="true", 
+                    <code>&lt;notNull&gt;</code> - It's not a conditional constraint. Either your mapping are always required, in which case you should specify them as notNull="true",
                     or not.
                 </para>
             </listitem>
             <listitem>
                 <para>
-                    &lt;length&gt;, &lt;precision&gt;, &lt;scale&gt; - length, scale and precision are used to specify the mapping precisely.
+                    <code>&lt;length&gt;, &lt;precision&gt;, &lt;scale&gt;</code> - length, scale and precision are used to specify the mapping precisely.
                 </para>
             </listitem>
         </itemizedlist>
-        <para>Note that you could write the elements above as attributes of &lt;type&gt;, for example:</para>
-        <programlisting language="xml">
-            &lt;type java="java built-in type"
-                jdbc="java.sql.Types Name"
-                length="Numeric value"
-                precision="Numeric value"
-                scale="Numeric value"
-                notNull="true|false"/&gt;
-        </programlisting>
+        <para>Note that you could write the elements above as attributes of <code>&lt;type&gt;</code>, for example:</para>
+        <programlisting language="xml">    &lt;type java="java built-in type"
+        jdbc="java.sql.Types Name"
+        length="Numeric value"
+        precision="Numeric value"
+        scale="Numeric value"
+        notNull="true|false"/&gt;</programlisting>
         <para>
-            The number of attributes specified in &lt;type&gt; and the order of the &lt;type&gt; is important for types mapping.
-            If &lt;typeMapper&gt; and &lt;type&gt; specifications are found in &lt;reverseEngineering&gt;, then they will be applied for all 
-            reverse engineering schemas and catalogs. Otherwise, Cayenne will automatically choose default behaviour for all schema and catalogs: 
-            java.sql.Types will be mapped to java built in types or wrapper class types.
+            The number of attributes specified in <code>&lt;type&gt;</code> and the order of the <code>&lt;type&gt;</code> is important for types mapping.
+            If <code>&lt;typeMapper&gt;</code> and <code>&lt;type&gt;</code> specifications are found in <code>&lt;reverseEngineering&gt;</code>, then they will be applied for all
+            reverse engineering schemas and catalogs. Otherwise, Cayenne will automatically choose default behaviour for all schema and catalogs:
+            <code>java.sql.Types</code> will be mapped to java built in types or wrapper class types.
         </para>        
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml b/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
index 4fdc932..b15a8b9 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/rop-deployment.xml
@@ -30,7 +30,7 @@
                 problem" protections of the container. E.g. the later can be achieved in Tomcat 7 by
                 adding the following <emphasis>context.xml</emphasis> file to the webapp's META-INF/
                 directory:
-                <programlisting>&lt;Context>
+                <programlisting language="xml">&lt;Context>
     &lt;Valve className="org.apache.catalina.authenticator.BasicAuthenticator"
             changeSessionIdOnAuthentication="false" />
 &lt;/Context></programlisting>(The

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/setup.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/setup.xml b/docs/docbook/cayenne-guide/src/docbkx/setup.xml
index d6aa512..704cfc1 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/setup.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/setup.xml
@@ -25,8 +25,8 @@
                     <para><emphasis role="italic">Java</emphasis>: Cayenne runtime framework and
                         CayenneModeler GUI tool are written in 100% Java, and run on any
                         Java-compatible platform. Minimal required JDK version depends on the
-                        version of Cayenne you are using, as shown in the following table: <table
-                            frame="void">
+                        version of Cayenne you are using, as shown in the following table:
+                        <table frame="void">
                             <caption>Cayenne Version History</caption>
                             <col width="28%"/>
                             <col width="36%"/>
@@ -77,8 +77,10 @@
                 <listitem>
                     <para><emphasis role="italic">Third-party Libraries:</emphasis> Cayenne runtime
                         framework has a minimal set of required and a few more optional dependencies
-                        on third-party open source packages. See "Including Cayenne in a Project"
-                        chapter for details.</para>
+                        on third-party open source packages. See
+                        <link linkend="including-cayenne-in-project">"Including Cayenne in a Project"</link>
+                        chapter for details.
+                    </para>
                 </listitem>
             </itemizedlist>
         </para>
@@ -88,33 +90,51 @@
         <para>CayenneModeler GUI tool is intended to work with object relational mapping projects. While
             you can edit your XML by hand, it is rarely needed, as the Modeler is a pretty advanced
             tool included in Cayenne distribution. To obtain CayenneModeler, download Cayenne
-            distribution archive from <link xlink:href="http://cayenne.apache.org/download.html"
-                >http://cayenne.apache.org/download.html</link> matching the OS you are using. Of
-            course Java needs to be installed on the machine where you are going to run the
-            Modeler.</para>
-        <para>OS X distribution contains CayenneModeler.app at the root of the distribution disk
-            image.</para>
-        <para>Windows distribution contains CayenneModeler.exe file in the <code>bin</code>
-            directory.</para>
-        <para>Cross-platform distribution (targeting Linux, but as the name implies, compatible with any
-            OS) contains a runnable CayenneModeler.jar in the <code>bin</code> directory. It can be
-            executed either by double-clicking, or if the environment is not configured to execute
-            jars, by running from command-line:</para>
-        <programlisting>java -jar CayenneModeler.jar</programlisting>
+            distribution archive from
+            <link xlink:href="http://cayenne.apache.org/download.html">http://cayenne.apache.org/download.html</link>
+            matching the OS you are using. Of course Java needs to be installed on the machine where
+            you are going to run the Modeler.
+        </para>
+        <itemizedlist>
+            <listitem>
+                <para>OS X distribution contains CayenneModeler.app at the root of the distribution disk
+                    image.
+                </para>
+            </listitem>
+            <listitem>
+                <para>Windows distribution contains CayenneModeler.exe file in the
+                    <code>bin</code>
+                    directory.
+                </para>
+            </listitem>
+            <listitem>
+                <para>Cross-platform distribution (targeting Linux, but as the name implies, compatible with any
+                    OS) contains a runnable CayenneModeler.jar in the <code>bin</code> directory. It can be
+                    executed either by double-clicking, or if the environment is not configured to execute
+                    jars, by running from command-line:
+                </para>
+                <screen><prompt>$</prompt> java -jar CayenneModeler.jar</screen>
+            </listitem>
+        </itemizedlist>
+
         <para>The Modeler can also be started from Maven. While it may look like an exotic way to start a
             GUI application, it has its benefits - no need to download Cayenne distribution, the
             version of the Modeler always matches the version of the framework, the plugin can find
-            mapping files in the project automatically. So is an attractive option to some
+            mapping files in the project automatically. So it is an attractive option to some
             developers. Maven option requires a declaration in the
-            POM:<programlisting>&lt;build>
+            POM:
+            <programlisting language="xml">&lt;build>
     &lt;plugins>
         &lt;plugin>
             &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
             &lt;artifactId>maven-cayenne-modeler-plugin&lt;/artifactId>
-            &lt;version>X.Y.Z&lt;/version>
+            &lt;version><?eval ${project.version}?>&lt;/version>
         &lt;/plugin>
     &lt;/plugins>
-&lt;/build></programlisting></para>
-        <para>And then can be run as <programlisting>mvn cayenne-modeler:run</programlisting></para>
+&lt;/build></programlisting>
+        </para>
+        <para>And then can be run as
+            <screen><prompt>$</prompt> mvn cayenne-modeler:run</screen>
+        </para>
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml b/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
index 4bb5cd2..a1302f9 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/starting-cayenne.xml
@@ -114,7 +114,7 @@ ServerRuntime runtime = new ServerRuntime("com/example/cayenne-project.xml", ext
         <para>Still Cayenne includes a piece of web app configuration code that can assist in
             quickly setting up simple Cayenne-enabled web applications. We are talking about
             CayenneFilter. It is declared in
-            web.xml:<programlisting>&lt;web-app>
+            web.xml:<programlisting language="xml">&lt;web-app>
     ...
     &lt;filter>
         &lt;filter-name>cayenne-project&lt;/filter-name>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/images/re-modeler-datasource-select.png
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/images/re-modeler-datasource-select.png b/docs/docbook/cayenne-guide/src/images/re-modeler-datasource-select.png
new file mode 100644
index 0000000..79ada1c
Binary files /dev/null and b/docs/docbook/cayenne-guide/src/images/re-modeler-datasource-select.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/images/re-modeler-reverseengineering-dialog.png
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/images/re-modeler-reverseengineering-dialog.png b/docs/docbook/cayenne-guide/src/images/re-modeler-reverseengineering-dialog.png
new file mode 100644
index 0000000..bea9c78
Binary files /dev/null and b/docs/docbook/cayenne-guide/src/images/re-modeler-reverseengineering-dialog.png differ

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
----------------------------------------------------------------------
diff --git a/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css b/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
index 57f7ea6..c6e8ad2 100644
--- a/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
+++ b/docs/docbook/docbook-stylesheets/src/main/resources/css/cayenne-doc.css
@@ -67,6 +67,14 @@ pre.programlisting {
     clear:         both;
 }
 
+pre.screen {
+    font-family: Courier New,monospace;
+    font-size:     10pt;
+    padding:       7pt 3pt;
+    border:        1pt solid black;
+    background:    #F9F9F6;
+}
+
 div.table {
     margin:        1em;
     padding:       0.5em;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
index 38dafb0..dd8288a 100644
--- a/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/index.xml
@@ -19,7 +19,7 @@
     <info>
         <title>Getting Started with Cayenne Reverse Engineering</title>
         <copyright>
-            <year>2011-2014</year>
+            <year>2011-<?dbtimestamp format="Y"?></year>
             <holder>Apache Software Foundation and individual authors</holder>
         </copyright>
         <legalnotice>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
index 13844b0..eb6dd33 100644
--- a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
@@ -24,32 +24,28 @@
             Shopping Cart and Customer. Considering the above sentence, we have a Java class and database
             table name called \u201cCustomer\u201d.</para>
         <para>Java Class:</para>
-        <programlisting language="java">
-            public class Customer {
+        <programlisting language="java">public class Customer {
 
-                private int id;
-                private String name;
+    private int id;
+    private String name;
 
-                public Customer(){
-                    // to do your instance initialization stuff here
-                }
+    public Customer(){
+        // to do your instance initialization stuff here
+    }
 
-                public  Customer(int id,String name){
-                    this.id = id;
-                    this.name = name;
-                }
+    public  Customer(int id,String name){
+        this.id = id;
+        this.name = name;
+    }
 
-                // getter and setter method goes here
+    // getter and setter method goes here
 
-            }
-        </programlisting>
+}</programlisting>
         <para>Database:</para>
-        <programlisting language="sql">
-            CREATE TABLE `customer` (
-            `id` INT(11) NOT NULL,
-            `name` VARCHAR(45) DEFAULT NULL,
-            PRIMARY KEY (`id`));
-        </programlisting>
+        <programlisting language="sql">CREATE TABLE `customer` (
+`id` INT(11) NOT NULL,
+`name` VARCHAR(45) DEFAULT NULL,
+PRIMARY KEY (`id`));</programlisting>
         <para>
             <inlinemediaobject>
                 <imageobject>
@@ -62,33 +58,29 @@
             due to the client requirement. In that case you have to update both Java class and table model manually.
         </para>
         <para>Java Class:</para>
-        <programlisting language="java">
-            public class Customer {
+        <programlisting language="java">public class Customer {
 
-                private int id;
-                private String firstname;
-                private String lastname;
-                public Customer(){
-                    // to do your instance initialization stuff here
-                }
+    private int id;
+    private String firstname;
+    private String lastname;
+    public Customer(){
+        // to do your instance initialization stuff here
+    }
 
-                public  Customer(int id,String fname,String lname){
-                    this.id = id;
-                    this.firstname = fname;
-                    this.lastname = lname;
-                }
+    public  Customer(int id,String fname,String lname){
+        this.id = id;
+        this.firstname = fname;
+        this.lastname = lname;
+    }
 
-                // getter and setter method goes here
-            }
-        </programlisting>
+    // getter and setter method goes here
+}</programlisting>
         <para>Database:</para>
-        <programlisting language="sql">
-            CREATE TABLE `customer` (
-            `id` INT(11) NOT NULL,
-            `firstname` VARCHAR(45) DEFAULT NULL,
-            `lastname` VARCHAR(45) DEFAULT NULL,
-            PRIMARY KEY (`id`));
-        </programlisting>
+        <programlisting language="sql">CREATE TABLE `customer` (
+`id` INT(11) NOT NULL,
+`firstname` VARCHAR(45) DEFAULT NULL,
+`lastname` VARCHAR(45) DEFAULT NULL,
+PRIMARY KEY (`id`));</programlisting>
         <para>
             <inlinemediaobject>
                 <imageobject>
@@ -130,82 +122,84 @@
             You could use CDBImport Maven plugin by declaring and configuring it in your pom.xml.
             See an example with comments below:
         </para>
-        <programlisting language="xml">
-            &lt;profile&gt;
-                &lt;!-- Here we define a profile with cdbimport and cgen configurations.
-                For sure you could define all plugins in general build section, but it will be time consuming
-                during each build to load database structure and check it for changes. Also, you will probably want to
-                control when exactly reverse engineering happens in order to correct its results if necessary. --&gt;
-                &lt;id>ormsync&lt;/id&gt;
-                &lt;build&gt;
-                    &lt;plugins&gt;
-                        &lt;plugin&gt;
-                            &lt;groupId&gt;org.apache.cayenne.plugins&lt;/groupId&gt;
-                            &lt;artifactId&gt;maven-cayenne-plugin&lt;/artifactId&gt;
-                            &lt;version&gt;4.0.M3&lt;/version&gt;
-                            &lt;executions&gt;
-                                &lt;execution&gt;
-                                    &lt;id&gt;ormsync&lt;/id&gt;
-                                    &lt;goals&gt;
-                                        &lt;!-- Again, cdbimport is a part of reverse engineering process.
-                                        Next step is generating Java classes according to their mapping by cgen. --&gt;
-                                        &lt;goal&gt;cdbimport&lt;/goal&gt;
-                                        &lt;goal&gt;cgen&lt;/goal&gt;
-                                    &lt;/goals&gt;
-                                    &lt;configuration&gt;
-                                        &lt;!-- At first, we have to define database connection information
-                                        from which the structure will be loaded. --&gt;
-                                        &lt;driver&gt;com.mysql.jdbc.Driver&lt;/driver&gt;
-                                        &lt;url&gt;jdbc:mysql://127.0.0.1:3306/test&lt;/url&gt;
-                                        &lt;username&gt;root&lt;/username&gt;
-                                        &lt;!--&lt;password&gt;password&lt;/password&gt;--&gt;
-                                        &lt;!-- Next step is to define mapping file, which we are going to use.
-                                        If it doesn't exist, it will be created automatically after the first plugin execution.
-                                        Here you could also define some mapping properties. It isn't necessary for cdbimport task, but it will be used by cgen. --&gt;
-                                        &lt;map&gt;${project.basedir}/src/main/resources/shopping.map.xml&lt;/map&gt;
-                                        &lt;defaultPackage&gt;org.apache.cayenne.shopping&lt;/defaultPackage&gt;
-                                        &lt;superPkg&gt;org.apache.cayenne.shopping.auto&lt;/superPkg&gt;
-                                        &lt;!-- Last part of configuration is reverse engineering tuning.
-                                        Here we just define which catalogs we want to process and which tables should be excluded.
-                                        You could find detailed description of possible configurations in the documentation. --&gt;
-                                        &lt;catalog&gt;test&lt;/catalog&gt;
-                                        &lt;excludeTables&gt;system_patch,v_*,*_view&lt;/excludeTables&gt;
-                                    &lt;/configuration&gt;
-                                &lt;/execution&gt;
-                            &lt;/executions&gt;
-                            &lt;dependencies&gt;
-                                &lt;!-- Also, you have to add JDBC driver dependency. --&gt;
-                                &lt;dependency&gt;
-                                    &lt;groupId&gt;mysql&lt;/groupId&gt;
-                                    &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
-                                    &lt;version&gt;5.1.28&lt;/version&gt;
-                                &lt;/dependency&gt;
-                            &lt;/dependencies&gt;
-                        &lt;/plugin&gt;
-                    &lt;/plugins&gt;
-                &lt;/build&gt;
-            &lt;/profile&gt;
-        </programlisting>
+        <programlisting language="xml">&lt;profile&gt;
+    &lt;!-- Here we define a profile with cdbimport and cgen configurations.
+    For sure you could define all plugins in general build section, but it will be time consuming
+    during each build to load database structure and check it for changes. Also, you will probably want to
+    control when exactly reverse engineering happens in order to correct its results if necessary. --&gt;
+    &lt;id>ormsync&lt;/id&gt;
+    &lt;build&gt;
+        &lt;plugins&gt;
+            &lt;plugin&gt;
+                &lt;groupId&gt;org.apache.cayenne.plugins&lt;/groupId&gt;
+                &lt;artifactId&gt;maven-cayenne-plugin&lt;/artifactId&gt;
+                &lt;version&gt;<?eval ${project.version}?>&lt;/version&gt;
+                &lt;executions&gt;
+                    &lt;execution&gt;
+                        &lt;id&gt;ormsync&lt;/id&gt;
+                        &lt;goals&gt;
+                            &lt;!-- Again, cdbimport is a part of reverse engineering process.
+                            Next step is generating Java classes according to their mapping by cgen. --&gt;
+                            &lt;goal&gt;cdbimport&lt;/goal&gt;
+                            &lt;goal&gt;cgen&lt;/goal&gt;
+                        &lt;/goals&gt;
+                        &lt;configuration&gt;
+                            &lt;!-- At first, we have to define database connection information
+                            from which the structure will be loaded. --&gt;
+                            &lt;driver&gt;com.mysql.jdbc.Driver&lt;/driver&gt;
+                            &lt;url&gt;jdbc:mysql://127.0.0.1:3306/test&lt;/url&gt;
+                            &lt;username&gt;root&lt;/username&gt;
+                            &lt;!--&lt;password&gt;password&lt;/password&gt;--&gt;
+                            &lt;!-- Next step is to define mapping file, which we are going to use.
+                            If it doesn't exist, it will be created automatically after the first plugin execution.
+                            Here you could also define some mapping properties. It isn't necessary for cdbimport task, but it will be used by cgen. --&gt;
+                            &lt;map&gt;${project.basedir}/src/main/resources/shopping.map.xml&lt;/map&gt;
+                            &lt;defaultPackage&gt;org.apache.cayenne.shopping&lt;/defaultPackage&gt;
+                            &lt;superPkg&gt;org.apache.cayenne.shopping.auto&lt;/superPkg&gt;
+                            &lt;!-- Last part of configuration is reverse engineering tuning.
+                            Here we just define which catalogs we want to process and which tables should be excluded.
+                            You could find detailed description of possible configurations in the <link xlink:href="http://cayenne.apache.org/docs/4.0/cayenne-guide/including-cayenne-in-project.html#mvn-cdbimport">documentation</link>. --&gt;
+                            &lt;reverseEngineering>
+                                &lt;catalog&gt;
+                                    &lt;name>test&lt;/name>
+                                    &lt;excludeTable>system_patch&lt;/excludeTable>
+                                    &lt;excludeTable>v_*&lt;/excludeTable>
+                                    &lt;excludeTable>*_view&lt;/excludeTable>
+                                &lt;/catalog&gt;
+                            &lt;/reverseEngineering>
+                        &lt;/configuration&gt;
+                    &lt;/execution&gt;
+                &lt;/executions&gt;
+                &lt;dependencies&gt;
+                    &lt;!-- Also, you have to add JDBC driver dependency. --&gt;
+                    &lt;dependency&gt;
+                        &lt;groupId&gt;mysql&lt;/groupId&gt;
+                        &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
+                        &lt;version&gt;5.1.28&lt;/version&gt;
+                    &lt;/dependency&gt;
+                &lt;/dependencies&gt;
+            &lt;/plugin&gt;
+        &lt;/plugins&gt;
+    &lt;/build&gt;
+&lt;/profile&gt;</programlisting>
         <para>
             Let\u2019s consider that shopping application consists of the following tables and relationships in database.
             Initially, we are going to take customer, order tables and one foreign key relationship between them.
         </para>
-        <para>SQL</para>
-        <programlisting language="sql">
-            CREATE TABLE `customer` (
-            `id` INT(11) NOT NULL,
-            `name` VARCHAR(50) DEFAULT NULL,
-            PRIMARY KEY (`id`));
+        <para>Database:</para>
+        <programlisting language="sql">CREATE TABLE `customer` (
+`id` INT(11) NOT NULL,
+`name` VARCHAR(50) DEFAULT NULL,
+PRIMARY KEY (`id`));
 
-            CREATE TABLE `order` (
-            `id` INT(11) NOT NULL,
-            `amount` DECIMAL(6,2) DEFAULT NULL,
-            `customer_id` INT(11) DEFAULT NULL,
-            PRIMARY KEY (`id`),
-            KEY `fk_customers_id_idx` (`customer_id`),
-            CONSTRAINT `fk_customers_id_refference` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`)
-            ON DELETE CASCADE ON UPDATE CASCADE);
-        </programlisting>
+CREATE TABLE `order` (
+`id` INT(11) NOT NULL,
+`amount` DECIMAL(6,2) DEFAULT NULL,
+`customer_id` INT(11) DEFAULT NULL,
+PRIMARY KEY (`id`),
+KEY `fk_customers_id_idx` (`customer_id`),
+CONSTRAINT `fk_customers_id_refference` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`)
+ON DELETE CASCADE ON UPDATE CASCADE);</programlisting>
         <para>
             <inlinemediaobject>
                 <imageobject>
@@ -217,50 +211,46 @@
             Now, please arrange the profile above for your custom DB settings. That\u2019s all you need to do for reverse
             engineering with Cayenne. Now you are able to run the reverse engineering task as described below.
         </para>
-        <programlisting>
-            mvn compile -Pormsync
-        </programlisting>
+        <screen><prompt>$</prompt> mvn compile -Pormsync</screen>
         <para>The output should look like this:</para>
-        <programlisting>
-            [INFO] Scanning for projects...
-            [INFO]
-            [INFO] ------------------------------------------------------------------------
-            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
-            [INFO] ------------------------------------------------------------------------
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.access.DbLoader load
-            INFO: Schema loading...
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 3:36:41 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            [INFO]   Table: test.customer
-            [INFO]   Table: test.order
-            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
-            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
-            [INFO]
-            [INFO] Map file does not exist. Loaded db model will be saved into '**/MySQLTest/src/main/resources/shopping.map.xml'
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
-            [INFO] Generating class file:**/MySQLTest/src/main/java/org/apache/cayenne/shopping/Customer.java
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
-            [INFO] Generating class file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/Order.java
-            [INFO]
-        </programlisting>
+        <screen>[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building MySQLTest 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.access.DbLoader load
+INFO: Schema loading...
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 3:36:41 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+[INFO]   Table: test.customer
+[INFO]   Table: test.order
+[INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+[INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+[INFO]
+[INFO] Map file does not exist. Loaded db model will be saved into '**/MySQLTest/src/main/resources/shopping.map.xml'
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+[INFO] Generating class file:**/MySQLTest/src/main/java/org/apache/cayenne/shopping/Customer.java
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+[INFO] Generating class file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/Order.java
+[INFO]</screen>
         <para>
             Above output demonstrates what was loaded from database (test.order, test.customer tables and customer_id relationships)
             by cdbimport task and which classes was generated by cgen task.
@@ -278,43 +268,41 @@
             but not subclasses (Customer.java, Order.java).
         </para>
         <para>Console will provide the following output:</para>
-        <programlisting>
-            [INFO] Scanning for projects...
-            [INFO]
-            [INFO] ------------------------------------------------------------------------
-            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
-            [INFO] ------------------------------------------------------------------------
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.access.DbLoader load
-            INFO: Schema loading...
-            Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 4:44:34 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 4:44:34 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            [INFO]   Table: test.customer
-            [INFO]   Table: test.order
-            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
-            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
-            [INFO]
-            [INFO] Detected changes: No changes to import.
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
-            [INFO]
-        </programlisting>
+        <screen>[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building MySQLTest 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.access.DbLoader load
+INFO: Schema loading...
+Aug 16, 2016 4:44:33 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 4:44:34 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 4:44:34 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+[INFO]   Table: test.customer
+[INFO]   Table: test.order
+[INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+[INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+[INFO]
+[INFO] Detected changes: No changes to import.
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+[INFO]</screen>
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
index 2a48924..65d06c0 100644
--- a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch2.xml
@@ -22,61 +22,55 @@
             Let's rename "name" column from the Customer table to the "first_name".
         </para>
         <para>
-            SQL
+            Database:
         </para>
-        <programlisting>
-            ALTER TABLE `customer` 
-            CHANGE COLUMN `name` `first_name` VARCHAR(50) NULL DEFAULT NULL ;
-        </programlisting>
+        <programlisting language="sql">ALTER TABLE `customer`
+CHANGE COLUMN `name` `first_name` VARCHAR(50) NULL DEFAULT NULL ;</programlisting>
         <para>
             Now we can do reverse engineering again by the command we already know:
         </para>
-        <programlisting>
-            mvn compile -Pormsync
-        </programlisting>
+        <screen><prompt>$</prompt> mvn compile -Pormsync</screen>
         <para>The output should look like this:</para>
-        <programlisting>
-            [INFO] Scanning for projects...
-            [INFO]
-            [INFO] ------------------------------------------------------------------------
-            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
-            [INFO] ------------------------------------------------------------------------
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
-            Aug 16, 2016 5:07:31 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.access.DbLoader load
-            INFO: Schema loading...
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:07:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            [INFO]   Table: test.customer
-            [INFO]   Table: test.order
-            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
-            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
-            [INFO]
-            [INFO] Detected changes:
-            [INFO]     Add Column           customer.first_name
-            [INFO]     Drop Column          customer.name
-            [INFO]
-            [INFO] Migration Complete Successfully.
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
-            [INFO]
-        </programlisting>
+        <screen>[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building MySQLTest 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+Aug 16, 2016 5:07:31 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.access.DbLoader load
+INFO: Schema loading...
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:07:32 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+[INFO]   Table: test.customer
+[INFO]   Table: test.order
+[INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+[INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+[INFO]
+[INFO] Detected changes:
+[INFO]     Add Column           customer.first_name
+[INFO]     Drop Column          customer.name
+[INFO]
+[INFO] Migration Complete Successfully.
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+[INFO]</screen>
         <para>
             As you could see, cdbimport task found and applied our changes to the model. Then, superclasses was updated by 
             cgen task to catch our changes. Notice that Cayenne treated a column renaming change as dropping and adding 
@@ -89,44 +83,42 @@
             Let\u2019s rename an "amount" ObjAttribute name to "totalPrice" in Order ObjectEntity. After running
             reverse engineering task, the output will show you no changes to import:
         </para>
-        <programlisting>
-            [INFO] Scanning for projects...
-            [INFO]
-            [INFO] ------------------------------------------------------------------------
-            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
-            [INFO] ------------------------------------------------------------------------
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.access.DbLoader load
-            INFO: Schema loading...
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:26:53 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            [INFO]   Table: test.customer
-            [INFO]   Table: test.order
-            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
-            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
-            [INFO]
-            [INFO] Detected changes: No changes to import.
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
-            [INFO]
-        </programlisting>
+        <screen>[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building MySQLTest 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.access.DbLoader load
+INFO: Schema loading...
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:26:53 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+[INFO]   Table: test.customer
+[INFO]   Table: test.order
+[INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+[INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+[INFO]
+[INFO] Detected changes: No changes to import.
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+[INFO]</screen>
         <para>
             As you could see, cdbimport task didn't detect any changes. Whenever you change anything in \u201cobj-attribute\u201d xml element 
             it will not reflect anything on the database side. But your changes will be reflected in auto generated java classes
@@ -142,16 +134,14 @@
         <para>
             SQL
         </para>
-        <programlisting language="sql">
-            CREATE TABLE `ordered_product` (
-            `customer_order_id` INT(11) NOT NULL,
-            `product_id` INT(11) DEFAULT NULL,
-            `quantity` SMALLINT(6) DEFAULT NULL,
-            PRIMARY KEY (`customer_order_id`),
-            KEY `fk_product_references_idx` (`product_id`),
-            CONSTRAINT `fk_order_references` FOREIGN KEY (`customer_order_id`) REFERENCES `order` (`id`) 
-            ON DELETE CASCADE ON UPDATE CASCADE);
-        </programlisting>
+        <programlisting language="sql">CREATE TABLE `ordered_product` (
+`customer_order_id` INT(11) NOT NULL,
+`product_id` INT(11) DEFAULT NULL,
+`quantity` SMALLINT(6) DEFAULT NULL,
+PRIMARY KEY (`customer_order_id`),
+KEY `fk_product_references_idx` (`product_id`),
+CONSTRAINT `fk_order_references` FOREIGN KEY (`customer_order_id`) REFERENCES `order` (`id`)
+ON DELETE CASCADE ON UPDATE CASCADE);</programlisting>
         <para>
             <inlinemediaobject>
                 <imageobject>
@@ -163,56 +153,54 @@
             After running the reverse engineering task again as described in the previous examples, the new output will 
             show a few actual DB operations:
         </para>
-        <programlisting>
-            [INFO] Scanning for projects...
-            [INFO]
-            [INFO] ------------------------------------------------------------------------
-            [INFO] Building MySQLTest 0.0.1-SNAPSHOT
-            [INFO] ------------------------------------------------------------------------
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.access.DbLoader load
-            INFO: Schema loading...
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
-            INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
-            INFO: +++ Connecting: SUCCESS.
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
-            INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
-            [INFO]   Table: test.customer
-            [INFO]   Table: test.order
-            [INFO]   Table: test.ordered_product
-            [INFO]     Db Relationship : toOne  (ordered_product.customer_order_id, order.id)
-            [INFO]     Db Relationship : toOne  (order.id, ordered_product.customer_order_id)
-            [INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
-            [INFO]     Db Relationship : toMany (customer.id, order.customer_id)
-            [INFO]
-            [INFO] Detected changes:
-            [INFO]     Add Relationship     customerOrder order->ordered_product.customer_order_id
-            [INFO]     Create Table         ordered_product
-            [INFO]
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.util.EntityMergeSupport addMissingRelationships
-            WARNING: Can't find ObjEntity for ordered_product
-            Aug 16, 2016 5:43:52 PM org.apache.cayenne.util.EntityMergeSupport addMissingRelationships
-            WARNING: Db Relationship (Db Relationship : toOne  (order.id, ordered_product.customer_order_id)) will have GUESSED Obj Relationship reflection.
-            [INFO] Migration Complete Successfully.
-            [INFO]
-            [INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
-            [INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_OrderedProduct.java
-            [INFO] Generating class file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/OrderedProduct.java
-            [INFO]
-        </programlisting>
+        <screen>[INFO] Scanning for projects...
+[INFO]
+[INFO] ------------------------------------------------------------------------
+[INFO] Building MySQLTest 0.0.1-SNAPSHOT
+[INFO] ------------------------------------------------------------------------
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cdbimport (ormsync) @ MySQLTest ---
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.access.DbLoader load
+INFO: Schema loading...
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource logConnect
+INFO: Connecting to 'jdbc:mysql://127.0.0.1:3306/test' as 'root'
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.datasource.DriverDataSource getConnection
+INFO: +++ Connecting: SUCCESS.
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.log.CommonsJdbcEventLogger log
+INFO: Detected and installed adapter: org.apache.cayenne.dba.mysql.MySQLAdapter
+[INFO]   Table: test.customer
+[INFO]   Table: test.order
+[INFO]   Table: test.ordered_product
+[INFO]     Db Relationship : toOne  (ordered_product.customer_order_id, order.id)
+[INFO]     Db Relationship : toOne  (order.id, ordered_product.customer_order_id)
+[INFO]     Db Relationship : toOne  (order.customer_id, customer.id)
+[INFO]     Db Relationship : toMany (customer.id, order.customer_id)
+[INFO]
+[INFO] Detected changes:
+[INFO]     Add Relationship     customerOrder order->ordered_product.customer_order_id
+[INFO]     Create Table         ordered_product
+[INFO]
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.util.EntityMergeSupport addMissingRelationships
+WARNING: Can't find ObjEntity for ordered_product
+Aug 16, 2016 5:43:52 PM org.apache.cayenne.util.EntityMergeSupport addMissingRelationships
+WARNING: Db Relationship (Db Relationship : toOne  (order.id, ordered_product.customer_order_id)) will have GUESSED Obj Relationship reflection.
+[INFO] Migration Complete Successfully.
+[INFO]
+[INFO] --- maven-cayenne-plugin:4.0.M3:cgen (ormsync) @ MySQLTest ---
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Customer.java
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_Order.java
+[INFO] Generating superclass file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/auto/_OrderedProduct.java
+[INFO] Generating class file: **/MySQLTest/src/main/java/org/apache/cayenne/shopping/OrderedProduct.java
+[INFO]</screen>
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/getting-started-rop/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-rop/src/docbkx/index.xml b/docs/docbook/getting-started-rop/src/docbkx/index.xml
index a83a43e..c6814f4 100644
--- a/docs/docbook/getting-started-rop/src/docbkx/index.xml
+++ b/docs/docbook/getting-started-rop/src/docbkx/index.xml
@@ -19,7 +19,7 @@
     <info>
         <title>Getting Started with Cayenne ROP (Remote Object Persistence)</title>
         <copyright>
-            <year>2011-2014</year>
+            <year>2011-<?dbtimestamp format="Y"?></year>
             <holder>Apache Software Foundation and individual authors</holder>
         </copyright>
         <legalnotice>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/getting-started/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started/src/docbkx/index.xml b/docs/docbook/getting-started/src/docbkx/index.xml
index b8df6da..7e84a36 100644
--- a/docs/docbook/getting-started/src/docbkx/index.xml
+++ b/docs/docbook/getting-started/src/docbkx/index.xml
@@ -19,7 +19,7 @@
     <bookinfo>
         <title>Getting Started with Cayenne</title>
         <copyright>
-            <year>2011-2014</year>
+            <year>2011-<?dbtimestamp format="Y"?></year>
             <holder>Apache Software Foundation and individual authors</holder>
         </copyright>
         <legalnotice>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/pom.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/pom.xml b/docs/docbook/pom.xml
index 6d3bf9e..78fa9c7 100644
--- a/docs/docbook/pom.xml
+++ b/docs/docbook/pom.xml
@@ -55,7 +55,7 @@
 				<plugin>
 					<groupId>com.agilejava.docbkx</groupId>
 					<artifactId>docbkx-maven-plugin</artifactId>
-					<version>2.0.14</version>
+					<version>2.0.17</version>
 					<dependencies>
 						<dependency>
 							<groupId>org.docbook</groupId>
@@ -102,6 +102,11 @@
 							<htmlCustomization>${project.stylesheetdir}/stylesheets/html.xsl</htmlCustomization>
 							<chunkedOutput>true</chunkedOutput>
 							<postProcess>
+								<move todir="${basedir}/target/site/index">
+									<fileset dir="${basedir}/target/site/">
+										<include name="*.html"/>
+									</fileset>
+								</move>
 								<copy todir="${basedir}/target/site/index/css">
 									<fileset dir="${project.stylesheetdir}/css" />
 								</copy>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/upgrade-guide/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/upgrade-guide/src/docbkx/index.xml b/docs/docbook/upgrade-guide/src/docbkx/index.xml
index 439474a..91b0609 100644
--- a/docs/docbook/upgrade-guide/src/docbkx/index.xml
+++ b/docs/docbook/upgrade-guide/src/docbkx/index.xml
@@ -4,7 +4,7 @@
     <info>
         <title>Cayenne 4.0 New Features and Upgrade Guide</title>
         <copyright>
-            <year>2011-2014</year>
+            <year>2011-<?dbtimestamp format="Y"?></year>
             <holder>Apache Software Foundation and individual authors</holder>
         </copyright>
         <legalnotice>


[5/5] cayenne git commit: Merge branch '104'

Posted by sk...@apache.org.
Merge branch '104'


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/71f99447
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/71f99447
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/71f99447

Branch: refs/heads/master
Commit: 71f9944786f08367978459d08c595a252ed14953
Parents: ca0ef28 34be65a
Author: Savva Kolbachev <s....@gmail.com>
Authored: Tue Dec 6 16:15:51 2016 +0300
Committer: Savva Kolbachev <s....@gmail.com>
Committed: Tue Dec 6 16:15:51 2016 +0300

----------------------------------------------------------------------
 .../src/docbkx/cayenne-mapping-structure.xml    |   8 +-
 .../src/docbkx/cayennemodeler-application.xml   |  56 +++
 .../src/docbkx/customizing-cayenne-runtime.xml  |   4 +-
 .../cayenne-guide/src/docbkx/expressions.xml    |  32 +-
 .../src/docbkx/including-cayenne-in-project.xml | 134 +++----
 docs/docbook/cayenne-guide/src/docbkx/index.xml |   6 +-
 docs/docbook/cayenne-guide/src/docbkx/part4.xml |  27 ++
 .../src/docbkx/performance-tuning.xml           |  24 +-
 .../docbkx/persistent-objects-objectcontext.xml |   4 +-
 .../cayenne-guide/src/docbkx/queries.xml        |  40 +-
 .../cayenne-guide/src/docbkx/re-filtering.xml   | 371 +++++++++++++++++++
 .../src/docbkx/re-introduction.xml              | 143 +++++++
 .../cayenne-guide/src/docbkx/re-modeler.xml     | 113 ++++++
 .../src/docbkx/re-name-generator.xml            |  79 ++++
 .../docbkx/re-relationships-loading-control.xml |  93 +++++
 .../cayenne-guide/src/docbkx/re-table-types.xml |  40 ++
 .../src/docbkx/re-types-mapping.xml             | 120 ++++++
 .../cayenne-guide/src/docbkx/rop-deployment.xml |   2 +-
 docs/docbook/cayenne-guide/src/docbkx/setup.xml |  64 ++--
 .../src/docbkx/starting-cayenne.xml             |   2 +-
 .../src/images/re-modeler-datasource-select.png | Bin 0 -> 32658 bytes
 .../re-modeler-reverseengineering-dialog.png    | Bin 0 -> 29936 bytes
 .../src/main/resources/css/cayenne-doc.css      |   8 +
 .../getting-started-reverse-engineering/pom.xml |  41 ++
 .../src/docbkx/index.xml                        |  42 +++
 .../src/docbkx/reverse-engineering-ch1.xml      | 308 +++++++++++++++
 .../src/docbkx/reverse-engineering-ch2.xml      | 206 ++++++++++
 .../images/customer-order-ordered_product.png   | Bin 0 -> 29330 bytes
 .../src/images/customer-order.png               | Bin 0 -> 16562 bytes
 .../src/images/customer1.png                    | Bin 0 -> 9652 bytes
 .../src/images/customer2.png                    | Bin 0 -> 11504 bytes
 .../getting-started-rop/src/docbkx/index.xml    |   2 +-
 .../getting-started/src/docbkx/index.xml        |   2 +-
 docs/docbook/pom.xml                            |   8 +-
 docs/docbook/upgrade-guide/src/docbkx/index.xml |   2 +-
 35 files changed, 1829 insertions(+), 152 deletions(-)
----------------------------------------------------------------------



[2/5] cayenne git commit: Reverse Engineering Documentation

Posted by sk...@apache.org.
Reverse Engineering Documentation


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/320495e1
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/320495e1
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/320495e1

Branch: refs/heads/master
Commit: 320495e1e67a0347d8ce5bb99a5cc634b30b4843
Parents: ed2f6c0
Author: Savva Kolbachev <s....@gmail.com>
Authored: Fri Aug 19 16:10:52 2016 +0300
Committer: Savva Kolbachev <s....@gmail.com>
Committed: Fri Aug 19 16:10:52 2016 +0300

----------------------------------------------------------------------
 docs/docbook/cayenne-guide/src/docbkx/index.xml |   1 +
 docs/docbook/cayenne-guide/src/docbkx/part4.xml |  26 ++
 .../cayenne-guide/src/docbkx/re-filtering.xml   | 336 +++++++++++++++++++
 .../src/docbkx/re-introduction.xml              |  83 +++++
 .../src/docbkx/re-name-generator.xml            |  73 ++++
 .../docbkx/re-relationships-loading-control.xml |  95 ++++++
 .../cayenne-guide/src/docbkx/re-table-types.xml |  42 +++
 .../src/docbkx/re-types-mapping.xml             | 122 +++++++
 .../src/docbkx/reverse-engineering-ch1.xml      |   6 +-
 9 files changed, 780 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/index.xml b/docs/docbook/cayenne-guide/src/docbkx/index.xml
index a2ac46c..048bfca 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/index.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/index.xml
@@ -40,6 +40,7 @@
     <xi:include href="part1.xml"/>
     <xi:include href="part2.xml"/>
     <xi:include href="part3.xml"/>
+    <xi:include href="part4.xml"/>
     <xi:include href="appendix-a.xml"/>
     <xi:include href="appendix-b.xml"/>
     <xi:include href="appendix-c.xml"/>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/part4.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/part4.xml b/docs/docbook/cayenne-guide/src/docbkx/part4.xml
new file mode 100644
index 0000000..e6d2a45
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/part4.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+	Licensed to the Apache Software Foundation (ASF) under one or more
+	contributor license agreements. See the NOTICE file distributed with
+	this work for additional information regarding copyright ownership.
+	The ASF licenses this file to you under the Apache License, Version
+	2.0 (the "License"); you may not use this file except in compliance
+	with the License. You may obtain a copy of the License at
+	
+	http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+	applicable law or agreed to in writing, software distributed under the
+	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+	CONDITIONS OF ANY KIND, either express or implied. See the License for
+	the specific language governing permissions and limitations under the
+	License.
+-->
+<part xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
+    xml:id="cayenne-guide-part4" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <title>Cayenne Framework - Reverse Engineering </title>
+    <xi:include href="re-introduction.xml"/>
+	<xi:include href="re-filtering.xml"/>
+	<xi:include href="re-relationships-loading-control.xml"/>
+	<xi:include href="re-name-generator.xml"/>
+	<xi:include href="re-table-types.xml"/>
+	<xi:include href="re-types-mapping.xml"/>
+</part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml b/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
new file mode 100644
index 0000000..b36c7f2
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
@@ -0,0 +1,336 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="5.0" xml:id="re-filtering">
+    <title>Filtering</title>
+    <para>
+        The first thing you usually want to control during reverse engineering is what exactly should be loaded from database and
+        what not. One of the most common cases is excluding system tables, as you usually don't want to map them.
+    </para>
+    <para>
+        Briefly, you are able to include/exclude tables, columns and procedures and do it at several levels: default, catalog, schema.
+        Although everything defined at the top level (default rules) will be applied for the nested elements, all rules from the most specific
+        areas will override general rules (i.e. rules from schemas override rules from catalogs and even more override default rules).
+    </para>
+    <para>
+        The following use-cases will provide you a better understanding of how filtering works and how you could use it.
+    </para>
+    <section xml:id="everything-schema-catalog">
+        <title>Process everything from schema/catalog</title>
+        <para>
+            The simplest example of reverse engineering is processing tables from one schema of catalog and there are several options to do this. 
+            Basic syntax is described below:
+        </para>
+        <programlisting language="xml">
+            &lt;!-- Ant/Maven in case you only want to specify the schema to import --&gt;
+            &lt;schema&gt;SCHEMA_NAME&lt;/schema&gt;
+
+            &lt;!-- Maven way in case you have nested elements in the schema  --&gt;
+            &lt;schema&gt;
+                &lt;name&gt;SCHEMA_NAME&lt;/name&gt;
+                ...
+            &lt;/schema&gt;
+
+            &lt;!-- Ant way in case you have nested elements in the schema --&gt;
+            &lt;schema name="SCHEMA_NAME"&gt;
+                ...
+            &lt;/schema&gt;
+        </programlisting>
+        <para>
+            The same options are available for catalogs:
+        </para>
+        <programlisting language="xml">
+            &lt;!-- Ant/Maven in case you only want to specify the catalog to import --&gt;
+            &lt;catalog&gt;CATALOG_NAME&lt;/catalog&gt;
+            
+            &lt;!-- Maven way in case you have nested elements in the catalog --&gt;
+            &lt;catalog&gt;
+                &lt;name&gt;CATALOG_NAME&lt;/name&gt;
+                ...
+            &lt;/catalog&gt;
+
+            &lt;!-- Ant way in case you have nested elements in the catalog --&gt;
+                &lt;catalog name="CATALOG_NAME"&gt;
+                ...
+            &lt;/catalog&gt;
+        </programlisting>
+    </section>
+    <section xml:id="combine-schema-catalog">
+        <title>Combine Schema and Catalog filters</title>
+        <para>
+            Cayenne supports combination of different schemas and catalogs, and it filters data according to your requirements. 
+            You could achieve this by the following example of reverse engineering configuration:
+        </para>
+        <programlisting language="xml">
+            &lt;configuration&gt;
+                ...
+                &lt;reverseEngineering&gt;
+                
+                    &lt;catalog name="shop_01"&gt;
+                        &lt;schema name="schema-name-01"/&gt;
+                        &lt;schema name="schema-name-02"/&gt;
+                        &lt;schema name="schema-name-03"/&gt;
+                    &lt;/catalog&gt;
+
+                    &lt;catalog name="shop_02"&gt;
+                        &lt;schema name="schema-name-01"/&gt;
+                    &lt;/catalog&gt;
+
+                    &lt;catalog name="shop_03"&gt;
+                        &lt;schema name="schema-name-01"/&gt;
+                        &lt;schema name="schema-name-02"/&gt;
+                        &lt;schema name="schema-name-03"/&gt;
+                    &lt;/catalog&gt;
+                    
+                &lt;/reverseEngineering&gt;
+                ...
+            &lt;/configuration&gt;
+        </programlisting>
+        <para>
+            In the example above, Cayenne reverse engineering process contains three catalogs named as shop_01, shop_02 and shop_03, 
+            each of wich has their own schemas. Cayenne will load all data only from the declared catalogs and schemas.
+        </para>
+        <para>
+            If you want to load everything from database, you could simply declare catalog specification alone.
+        </para>
+        <programlisting language="xml">
+            &lt;configuration&gt;
+                ...
+                &lt;reverseEngineering&gt;
+                
+                    &lt;catalog name="shop_01"/&gt;
+                    &lt;catalog name="shop_02"/&gt;
+                    &lt;catalog name="shop_03"/&gt;
+
+                &lt;/reverseEngineering&gt;
+                ...
+            &lt;/configuration&gt;
+        </programlisting>
+        <para>
+            If you want to do reverse engineering for specific schemas, just remove unwanted schemas from the catalog section. 
+            For example, if you want to process schema-name-01 and schema-name-03 schemas only, then you should change reverse engineering section like this.
+        </para>
+        <programlisting language="xml">
+            &lt;configuration&gt;
+                ...
+                &lt;reverseEngineering&gt;
+                
+                    &lt;catalog name="shop_01"&gt;
+                        &lt;schema name="schema-name-01"/&gt;
+                        &lt;schema name="schema-name-03"/&gt;
+                    &lt;/catalog&gt;
+
+                    &lt;catalog name="shop_02"&gt;
+                        &lt;schema name="schema-name-01"/&gt;
+                    &lt;/catalog&gt;
+
+                    &lt;catalog name="shop_03"&gt;
+                        &lt;schema name="schema-name-01"/&gt;
+                        &lt;schema name="schema-name-03"/&gt;
+                    &lt;/catalog&gt;
+                    
+                &lt;/reverseEngineering&gt;
+                ...
+            &lt;/configuration&gt;
+        </programlisting>
+    </section>
+    <section xml:id="including-excluding-tables-columns-procedures">
+        <title>Including and Excluding tables, columns and procedures</title>
+        <para>
+            <itemizedlist>
+                <listitem>
+                    <para>1. Include tables with \u2018CRM_\u2019 prefix if you are working in that domain of application:</para>
+                    <programlisting language="xml">
+                &lt;includeTable&gt;CRM_.*&lt;/includeTable&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>2. Include tables with \u2018_LOOKUP\u2019 suffix</para>
+                    <programlisting language="xml">
+                &lt;includeTable&gt;
+                    &lt;pattern&gt;.*_LOOKUP&lt;/pattern&gt;
+                &lt;/includeTable&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>3. Exclude tables with \u2018CRM_\u2019 prefix if you are not working only in that domain of application:</para>
+                    <programlisting language="xml">
+                &lt;excludeTable&gt;CRM_.*&lt;/excludeTable&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>4. Include only specific columns that follows specific naming convention:</para>
+                    <programlisting language="xml">
+                &lt;includeColumn&gt;includeColumn01&lt;/includeColumn&gt;
+                &lt;includeColumn pattern="includeColumn03"/&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>5. Exclude system or obsolete columns:</para>
+                    <programlisting language="xml">
+                &lt;excludeColumn&gt;excludeColumn01&lt;/excludeColumn&gt;
+                &lt;excludeColumn pattern="excludeColumn03"/&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>6. Include/Exclude columns for particular table or group of tables:</para>
+                    <programlisting language="xml">
+                &lt;includeTable pattern="table pattern"&gt;
+                    &lt;includeColumn pattern="includeColumn01"/&gt;
+                    &lt;excludeColumn pattern="excludeColumn01"/&gt;
+                &lt;/includeTable&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>7. Include stored procedures:</para>
+                    <programlisting language="xml">
+                &lt;includeProcedure&gt;includeProcedure01&lt;/includeProcedure&gt;
+                &lt;includeProcedure pattern="includeProcedure03"/&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>8. Exclude stored procedures by pattern:</para>
+                    <programlisting language="xml">
+                &lt;excludeProcedure&gt;excludeProcedure01&lt;/excludeProcedure&gt;
+                &lt;excludeProcedure pattern="excludeProcedure03"/&gt;
+                    </programlisting>
+                </listitem>
+            </itemizedlist>
+        </para>
+        <para>
+            All filtering tags includeTable, excludeTable, includeColumn, excludeColumn, includeProcedure and excludeProcedure have three ways 
+            to pass filtering RegExp.
+            <itemizedlist>
+                <listitem>
+                    <para>text inside tag</para>
+                    <programlisting language="xml">
+                &lt;includeTable&gt;CRM_.*&lt;/includeTable&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>pattern attribute</para>
+                    <programlisting language="xml">
+                &lt;excludeProcedure pattern="excludeProcedure03"/&gt;
+                    </programlisting>
+                </listitem>
+                <listitem>
+                    <para>pattern inner tag</para>
+                    <programlisting language="xml">
+                &lt;includeTable&gt;
+                    &lt;pattern&gt;.*_LOOKUP&lt;/pattern&gt;
+                &lt;/includeTable&gt;
+                    </programlisting>
+                </listitem>
+            </itemizedlist>
+        </para>
+        <para>
+            All filtering tags can be placed inside schema and catalog tags, but also inside &lt;reverseEngineering&gt; tag. It means that filtering rules
+            will be applied for all schemas and catalogs.
+        </para>
+    </section>
+    <section xml:id="complete-filtering-example">
+        <title>Complete filtering example</title>
+        <para>
+            Initially, let\u2019s make a small sample. Consider the following reverse engineering configuration.
+        </para>
+        <programlisting language="xml">
+                &lt;reverseEngineering&gt;
+                    &lt;catalog&gt;shop-01&lt;/catalog&gt;
+                &lt;/reverseEngineering&gt;
+        </programlisting>
+        <para>
+            In this case reverse engineering will not filter anything from the shop-01 catalog. If you really want to filter database columns, tables, 
+            stored procedures and relationships, you could do it in the following way.
+        </para>
+        <programlisting language="xml">
+                &lt;reverseEngineering&gt;
+                    &lt;catalog&gt;shop-01&lt;/catalog&gt;
+                    &lt;catalog name="shop-02"&gt;
+                        &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
+                    &lt;/catalog&gt;
+                &lt;/reverseEngineering&gt;
+        </programlisting>
+        <para>
+            Then Cayenne will do reverse engineering for both shop-01 and shop-02 catalogs. First catalog will not be processed for filtering,
+            but the second catalog will be processed with \u201cincludeTable-01\u201d filter. 
+        </para>
+        <para>
+            Let\u2019s assume you have a lot of table prefixes with the same names. Cayenne allows you to mention a pattern as regular expression.
+            Using regular expressions is easier way to handle a big amount of database entities than writing filter config for each use-case.
+            They make your configuration more readable, understandable and straightforward. There is not complex.
+            Let\u2019s see how to use patterns in reverse engineering configuration with complete example.
+        </para>
+        <programlisting language="xml">
+                &lt;reverseEngineering&gt;
+
+                    &lt;catalog&gt;shop-01&lt;/catalog&gt;
+
+                    &lt;catalog&gt;
+                        &lt;name&gt;shop-02&lt;/name&gt;
+                    &lt;/catalog&gt;
+
+                    &lt;catalog name="shop-03"&gt;
+                        &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
+
+                        &lt;includeTable&gt;
+                            &lt;pattern&gt;includeTable-02&lt;/pattern&gt;
+                        &lt;/includeTable&gt;
+
+                        &lt;includeTable pattern="includeTable-03"&gt;
+                            &lt;includeColumn pattern="includeColumn-01"/&gt;
+                            &lt;excludeColumn pattern="excludeColumn-01"/&gt;
+                        &lt;/includeTable&gt;
+
+                        &lt;excludeTable&gt;excludeTable-01&lt;/excludeTable&gt;
+
+                        &lt;excludeTable&gt;
+                            &lt;pattern&gt;excludeTable-02&lt;/pattern&gt;
+                        &lt;/excludeTable&gt;
+
+                        &lt;excludeTable pattern="excludeTable-03"/&gt;
+                        
+                        &lt;includeColumn&gt;includeColumn-01&lt;/includeColumn&gt;
+                        
+                        &lt;includeColumn&gt;
+                            &lt;pattern&gt;includeColumn-02&lt;/pattern&gt;
+                        &lt;/includeColumn&gt;
+                        
+                        &lt;includeColumn pattern="includeColumn-03"/&gt;
+
+                        &lt;excludeColumn&gt;excludeColumn-01&lt;/excludeColumn&gt;
+                        
+                        &lt;excludeColumn&gt;
+                            &lt;pattern&gt;excludeColumn-02&lt;/pattern&gt;
+                        &lt;/excludeColumn&gt;
+                        
+                        &lt;excludeColumn pattern="excludeColumn-03"/&gt;
+                        
+                        &lt;includeProcedure&gt;includeProcedure-01&lt;/includeProcedure&gt;
+                        
+                        &lt;includeProcedure&gt;
+                            &lt;pattern&gt;includeProcedure-02&lt;/pattern&gt;
+                        &lt;/includeProcedure&gt;
+                        
+                        &lt;includeProcedure pattern="includeProcedure-03"/&gt;
+
+                        &lt;excludeProcedure&gt;excludeProcedure-01&lt;/excludeProcedure&gt;
+                        
+                        &lt;excludeProcedure&gt;
+                            &lt;pattern&gt;excludeProcedure-02&lt;/pattern&gt;
+                        &lt;/excludeProcedure&gt;
+                        
+                        &lt;excludeProcedure pattern="excludeProcedure-03"/&gt;
+
+                    &lt;/catalog&gt;
+                &lt;/reverseEngineering&gt;
+        </programlisting>
+        <para>
+            The example above should provide you more idea about how to use filtering and patterns in Cayenne reverse engineering.
+            You could notice that this example demonstrates you the "name" and "pattern" configurations. Yes, you could use these as separates xml element
+            and xml attributes.
+        </para>
+        <para>
+            The cdbimport will execute reverse engineering task for all entities from \u201cshop-01\u201d and \u201cshop-02\u201d, including tables, views, stored procedures
+            and table columns. As \u201cshop-03\u201d has variety filter tags, entities from this catalog will be filtered by cdbimport.
+        </para>
+    </section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml b/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
new file mode 100644
index 0000000..3125a7b
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
@@ -0,0 +1,83 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="5.0" xml:id="re-introduction">
+    <title>Reverse Engineering Introduction</title>
+    <section xml:id="what-is-cdbimport">
+    	<title>What is CDBImport</title>
+    	<para>
+    		CDBImport is a Maven/Ant plugin that helps you to do reverse engineering. In other words it helps you to synchronize
+    		database structure with your Cayenne mapping config. It does not update Java classes by itself, but it synchronizes db
+    		and data access layer representation in Cayenne mapping file with actual database state.
+    		Most common practice to complete reverse engineering is to use CDBImport followed by CGen Maven plugin,
+    		which does class generation according to the Cayenne mapping file updates.
+    	</para>
+    </section>
+	<section xml:id="re-configuration-file">
+		<title>Reverse Engineering configuration file</title>
+		<para>
+			Cayenne is designed to support database reverse engineering automation process via Maven and Ant build tools. 
+			You could control and configure this process in the several ways:
+		</para>
+		<itemizedlist>
+			<listitem>
+				<para>Inside ANT/Maven build file</para>
+			</listitem>
+			<listitem>
+				<para>Externally in reverseEngineering.xml file, which will be used by Maven/Ant to perform cdbimport</para>
+			</listitem>
+		</itemizedlist>
+		<para>
+			Maven and Ant build files usually contain lots of configuration according to your project requirements. This is why reverseEngineering.xml
+			is designed as a sum of configuration styles of Maven and Ant. It will be quite easy to use and move your configuration from build file
+			definition into separate one. At practice you should be able to cut reverseEngineering section from Maven configuration and paste it into the 
+			external reverse engineering file without a problem. Then, put path to this file into config or it could be loaded from the datamap file. 
+			It should work for Ant at the same manner.
+		</para>
+		<para>
+			Note that each datamap has its own reverse engineering file, which is described by the &lt;reverse-engineering-config&gt; datamap tag.
+			<programlisting language="xml">
+			&lt;reverse-engineering-config name="reverseEngineering"/&gt;
+			</programlisting>
+		</para>
+		<para>
+			Here is a default template of reverse engineering file, which should help you to get started:
+		</para>
+		<programlisting language="xml">
+			&lt;?xml version="1.0" encoding="utf-8"?&gt;
+			&lt;reverseEngineering
+       				xmlns="http://cayenne.apache.org/schema/8/reverseEngineering"
+       				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       				xsi:schemaLocation="http://cayenne.apache.org/schema/8/reverseEngineering http://cayenne.apache.org/schema/8/reverseEngineering.xsd"&gt;
+
+    			&lt;skipRelationshipsLoading&gt;false&lt;/skipRelationshipsLoading&gt;
+    			&lt;skipPrimaryKeyLoading&gt;false&lt;/skipPrimaryKeyLoading&gt;
+
+    			&lt;catalog&gt;
+        			&lt;schema&gt;
+            			&lt;includeTable&gt;
+            			&lt;/includeTable&gt;
+        			&lt;/schema&gt;
+    			&lt;/catalog&gt;
+    			&lt;includeProcedure pattern=".*"/&gt;
+			&lt;/reverseEngineering&gt;
+		</programlisting>
+		<para>
+			Note that the whole database structure will be loaded after execution reverse engineering with this stub.
+		</para>
+	</section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml b/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
new file mode 100644
index 0000000..e89ebfa
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-name-generator.xml
@@ -0,0 +1,73 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="5.0" xml:id="re-name-generator">
+    <title>Name Generator</title>
+    <para>
+        Doing reverse engineering process, Cayenne have to translate database object names into names that follows Java naming convention. 
+        This page describes how Cayenne does this. 
+    </para>
+    <section xml:id="default-name-generator">
+        <title>Default Name Generator</title>
+        <para>
+            Usually, underscores are used for the word separations by db naming convention, while Java naming convention uses camelcase style. 
+            So, Cayenne uses this rule for almost all translations. The only exception is relationships naming, because they represented as foreign keys
+            in the database and often have absent or auto-generated names. As a consequence those names are meaningless.
+            In this case Cayenne tries to \u201cguess\u201d an appropriate name via the following rules:
+            <itemizedlist>
+                <listitem>
+                    <para>For explicit relationships (i.e PAINTING.ARTIST_ID), the column name is used. Cayenne cuts \u201cID\u201d and translates it into camelcase style,
+                        like ARTIST_ID -> artist</para>
+                </listitem>
+                <listitem>
+                    <para>For implicit relationships, it is usually a pluralized name of the target table in the camelcase</para>
+                </listitem>
+            </itemizedlist>
+        </para>
+        <table>
+            <tbody>
+                <tr>
+                    <td>OneToMany</td>
+                    <td>Implicit</td>
+                    <td>Explicit</td>
+                </tr>
+                <tr>
+                    <td>ARTIST.ARTIST_ID -- PAINTING.ARTIST_ID</td>
+                    <td>Artists.paintings</td>
+                    <td>Painting.artist</td>
+                </tr>
+                <tr>
+                    <td>PERSON.PERSON_ID -- PERSON.MOTHER_ID</td>
+                    <td>Person.people</td>
+                    <td>Person.mother</td>
+                </tr>
+                <tr>
+                    <td>PERSON.PERSON_ID -- ADDRESS.SHIPPING_ADDRESS_ID</td>
+                    <td>Person.addresses</td>
+                    <td>Address.shippingAddress</td>
+                </tr>
+            </tbody>
+        </table>
+    </section>
+    <section xml:id="customizing-name-generator">
+        <title>Cuztomizing Name Generator</title>
+        <para>
+            In case you want to customize the default naming strategy, you could set your own strategy through the namingStrategy option in the Maven or Ant 
+            configuration. Ensure that naming strategy class is in a class-path and implements ObjectNameGenerator interface.
+        </para>
+    </section>
+</chapter>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml b/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
new file mode 100644
index 0000000..bc0bc23
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-relationships-loading-control.xml
@@ -0,0 +1,95 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="5.0" xml:id="re-relationships-loading-control">
+    <title>Relationships Loading Control</title>
+    <para>
+        In databases relations are defined via foreign keys and there are a lot of different politics according to the level of relationships and 
+        ways how those relationships could be modeled in database. Anyway, cdbimport is able to recognize basic patterns of relationships, such as
+        OneToMany, OneToOne and ManyToMany. 
+    </para>
+    <section xml:id="one-to-many">
+        <title>OneToMany relationships</title>
+        <para>
+            One to many is the simplest case of the database relationships:
+            <itemizedlist>
+                <listitem>
+                    <para>There is a table A with primary key A.ID</para>
+                </listitem>
+                <listitem>
+                    <para>There is a table B with primary key B.ID and foreign key B.A_ID (defined through db reference)</para>
+                </listitem>
+            </itemizedlist>
+        </para>
+        <para>
+            This is a way to model one-to-many relationship from table A to table B. Note that this is an implicit relationship, because table A don\u2019t have
+            any evidence of data linkage with B. On the other hand, table B have explicit (column A_ID) link to the table A and it can have only one 
+            corresponding row from the table A. That\u2019s why for the  table B it is many-to-one relationships. 
+        </para>
+        <para>
+            This pattern is the most common, easily recognisable and successfully handled by cdbimport.
+        </para>
+    </section>
+    <section xml:id="one-to-one">
+        <title>OneToOne relationships</title>
+        <para>
+            One-to-one relationships are very similar with one-to-many. The only difference is that foreign key at the second table should also be a primary key:
+            <itemizedlist>
+                <listitem>
+                    <para>There is a table A with primary key A.ID </para>
+                </listitem>
+                <listitem>
+                    <para>There is a table B with primary key B.A_ID and foreign key B.A_ID (defined through db reference)</para>
+                </listitem>
+            </itemizedlist>
+        </para>
+        <para>
+            Overall, it means that there is one primary key for both tables. Only such structure will be treated as one-to-one relationship by cdbimport.
+        </para>
+    </section>
+    <section xml:id="many-to-many">
+        <title>ManyToMany</title>
+        <para>
+            This type of relationships usually modeled via join or junction table (http://en.wikipedia.org/wiki/Junction_table).
+            It is also successfully handled by cdbimport. Notice that join table should contain two and only two columns. Both of this columns 
+            should be included as primary keys. 
+        </para>
+    </section>
+    <section xml:id="skip-relationships-loading">
+        <title>Skip Relationships Loading</title>
+        <para>
+            You are able to skip relationships loading by the &lt;skipRelationshipsLoading&gt; element.
+        </para>
+        <programlisting language="xml">
+            &lt;reverseEngineering&gt;
+                &lt;skipRelationshipsLoading&gt;true&lt;skipRelationshipsLoading&gt;
+            &lt;/reverseEngineering&gt;
+        </programlisting>
+    </section>
+    <section xml:id="skip-pk-loading">
+        <title>Skip Primary Keys Loading</title>
+        <para>
+            Another useful Cayenne reverse engineering property is &lt;skipPrimaryKeyLoading&gt;. If you decide to support all relationships at the application layer
+            and avoid their management in database, you\u2019ll find useful to turn off primary keys synchronization at all.
+        </para>
+        <programlisting language="xml">
+            &lt;reverseEngineering&gt;
+                &lt;skipPrimaryKeyLoading&gt;true&lt;skipPrimaryKeyLoading&gt;
+            &lt;/reverseEngineering&gt;
+        </programlisting>
+    </section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml b/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
new file mode 100644
index 0000000..55403fe
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-table-types.xml
@@ -0,0 +1,42 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="5.0" xml:id="re-table-types">
+    <title>Table Types</title>
+    <para>
+        By default, cdbimport processes only tables and views from schema, but there are a lot of other objects that could be loaded from database,
+        such as SYSTEM TABLE, GLOBAL TEMPORARY, LOCAL TEMPORARY, ALIAS, SYNONYM, etc. Those things are specific for concrete databases and could be accepted
+        by the &lt;tableType&gt;&lt;tableType&gt; element.
+    </para>
+    <para>
+        Import only tables
+        <programlisting language="xml">
+                &lt;reverseEngineering>&gt;
+                    &lt;tableType&gt;TABLE&lt;/tableType&gt;
+                &lt;/reverseEngineering&gt;
+        </programlisting>
+    </para>
+    <para>
+        Tables and views (default option)
+        <programlisting language="xml">
+                &lt;reverseEngineering>&gt;
+                    &lt;tableType&gt;TABLE&lt;/tableType&gt;
+                    &lt;tableType&gt;VIEWS&lt;/tableType&gt;
+                &lt;/reverseEngineering&gt;
+        </programlisting>
+    </para>
+</chapter>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml b/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
new file mode 100644
index 0000000..274c4ec
--- /dev/null
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-types-mapping.xml
@@ -0,0 +1,122 @@
+<?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.
+-->
+<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="5.0" xml:id="re-types-mapping">
+    <title>Types Mapping</title>
+    <para>
+        Types mapping is a process of mapping between Database types and Java Classes through JDBC types that are represented by java.sql.Types.
+    </para>
+    <para>
+        By default, java.sql.Types will be mapped to Java built in types or wrapper class types. Actually, Cayenne allows you to override the default mapping.
+        You could use the &lt;typeMapper&gt; configuration section to customize how JDBC types should be identified in database and how they should be
+        mapped to Java Classes during reverse engineering process.
+    </para>
+    <para>
+        Sometimes you need to map database types to your custom Java Classes. If you really want to do this, then you should implement 
+        org.apache.cayenne.access.types.ExtendedType interface for your classes.
+    </para>
+    <section xml:id="basic-configuration">
+        <title>Basic Configuration</title>
+        <para>Here is an example of a basic typeMapper configuration:</para>
+        <programlisting language="xml">
+                &lt;reverseEngineering&gt;
+                    &lt;typeMapper&gt;
+                        &lt;mapperClassName&gt;class&lt;/mapperClassName&gt;
+                        &lt;usePrimitives&gt;false&lt;/usePrimitives&gt;
+                        &lt;type&gt;
+                            &lt;!-- Java type names--&gt;
+                            &lt;java&gt;java.math.BigDecimal&lt;/java&gt;
+                            &lt;!-- JDBC tag is name for java.sql.Types --&gt;
+                            &lt;jdbc&gt;DECIMAL&lt;/jdbc&gt;
+                            &lt;!-- Length, scale and precision can be used to specify the mapping precisely --&gt;
+                            &lt;precision&gt;16&lt;/precision&gt;
+                            &lt;scale&gt;2&lt;/scale&gt;
+                        &lt;/type&gt;
+                        &lt;type&gt;
+                            &lt;java&gt;java.lang.Long&lt;/java&gt;
+                            &lt;jdbc&gt;NUMERIC&lt;/jdbc&gt;
+                        &lt;/type&gt;
+                        &lt;type&gt;
+                            &lt;java&gt;java.lang.String&lt;/java&gt;
+                            &lt;jdbc&gt;VARCHAR&lt;/jdbc&gt;
+                            &lt;length&gt;100&lt;/length&gt;
+                            &lt;notNull&gt;true&lt;/notNull&gt;
+                        &lt;/type&gt;
+                        &lt;type&gt;
+                            &lt;java&gt;java.util.Date&lt;/java&gt;
+                            &lt;jdbc&gt;TIMESTAMP&lt;/jdbc&gt;
+                        &lt;/type&gt;
+                    &lt;/typeMapper&gt;
+                &lt;/reverseEngineering&gt;
+        </programlisting>
+        <itemizedlist>
+            <listitem>
+                <para>
+                    &lt;mapperClassName&gt; - name of the fully qualified custom Java mapper class.
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    &lt;usePrimitives&gt; -  allows you to make a decision whether to use primitives or not. It's quite useful, because primitives are faster than objects.
+                    If you want to use primitive type instead of wrapper type just set this option to true, otherwise false. It is more intuitive and has less overhead.
+                    If it is not possible because generics/autoboxing reasons, or if you want it to be nullable, then use the wrapper type. All the wrapper classes
+                    (Integer, Long, Byte, Double, Float, Short) are subclasses of the abstract class Number. The object of the wrapper class contains/wraps them respectively
+                    to the primitive data type. Converting primitive data types into objects is called boxing and compiler takes care about this. So, you don\u2019t need to use
+                    any special workarounds.
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    &lt;java&gt; - name of the fully qualified Java class for mapping. If the class is a primitive wrapper class such as java.lang.Integer, 
+                    the mapping also applies to the primitive type.
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    &lt;jdbc&gt; -  JDBC type which will be used by JDBC PreparedStatement, SQL Queries and for loading data from JDBC ResultSet. 
+                    The valid types are defined in java.sql.Types.
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    &lt;notNull&gt; - It's not a conditional constraint. Either your mapping are always required, in which case you should specify them as notNull="true", 
+                    or not.
+                </para>
+            </listitem>
+            <listitem>
+                <para>
+                    &lt;length&gt;, &lt;precision&gt;, &lt;scale&gt; - length, scale and precision are used to specify the mapping precisely.
+                </para>
+            </listitem>
+        </itemizedlist>
+        <para>Note that you could write the elements above as attributes of &lt;type&gt;, for example:</para>
+        <programlisting language="xml">
+            &lt;type java="java built-in type"
+                jdbc="java.sql.Types Name"
+                length="Numeric value"
+                precision="Numeric value"
+                scale="Numeric value"
+                notNull="true|false"/&gt;
+        </programlisting>
+        <para>
+            The number of attributes specified in &lt;type&gt; and the order of the &lt;type&gt; is important for types mapping.
+            If &lt;typeMapper&gt; and &lt;type&gt; specifications are found in &lt;reverseEngineering&gt;, then they will be applied for all 
+            reverse engineering schemas and catalogs. Otherwise, Cayenne will automatically choose default behaviour for all schema and catalogs: 
+            java.sql.Types will be mapped to java built in types or wrapper class types.
+        </para>        
+    </section>
+</chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/320495e1/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
index 454e91b..13844b0 100644
--- a/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
+++ b/docs/docbook/getting-started-reverse-engineering/src/docbkx/reverse-engineering-ch1.xml
@@ -109,8 +109,6 @@
                 <listitem>
                     <para>Forward Engineering  - Generating db schema according to the Java classes.</para>
                 </listitem>
-            </itemizedlist>
-            <itemizedlist>
                 <listitem>
                     <para>Reverse Engineering - Updating Java classes according to the database schema.</para>
                 </listitem>
@@ -122,10 +120,10 @@
     <section xml:id="basic-usage">
         <title>Basic Usage</title>
         <para>
-            CDBImport is a Maven plugin that helps you to do reverse engineering. In other words it helps you to synchronize
+            CDBImport is a Maven/Ant plugin that helps you to do reverse engineering. In other words it helps you to synchronize
             database structure with your Cayenne mapping config. It does not update Java classes by itself, but it synchronizes db
             and data access layer representation in Cayenne mapping file with actual database state.
-            Most common practice to complete reverse engineering is to use CGen Maven plugin after CDBImport,
+            Most common practice to complete reverse engineering is to use CDBImport followed by CGen Maven plugin,
             which does class generation according to the Cayenne mapping file updates.
         </para>
         <para>


[4/5] cayenne git commit: Cayenne documentation update - added Modeler reverse engineering tool description - docbook maven plugin updated - all docs updated to proper syntax highlight - css style added for console input/output elements ( tag

Posted by sk...@apache.org.
Cayenne documentation update
 - added Modeler reverse engineering tool description
 - docbook maven plugin updated
 - all docs updated to proper syntax highlight
 - css style added for console input/output elements (<screen> tag)
 - added links
 - updated cdbimport parameters
 - added some info about modeler
 - auto insert of the year and cayenne version


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/34be65a0
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/34be65a0
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/34be65a0

Branch: refs/heads/master
Commit: 34be65a0175ddd4919d681b19a52c3d8490f4ec8
Parents: 320495e
Author: Nikita Timofeev <st...@gmail.com>
Authored: Mon Dec 5 17:52:20 2016 +0300
Committer: Nikita Timofeev <st...@gmail.com>
Committed: Mon Dec 5 17:52:20 2016 +0300

----------------------------------------------------------------------
 .../src/docbkx/cayenne-mapping-structure.xml    |   8 +-
 .../src/docbkx/cayennemodeler-application.xml   |  56 +++
 .../src/docbkx/customizing-cayenne-runtime.xml  |   4 +-
 .../cayenne-guide/src/docbkx/expressions.xml    |  32 +-
 .../src/docbkx/including-cayenne-in-project.xml | 134 +++---
 docs/docbook/cayenne-guide/src/docbkx/index.xml |   5 +-
 docs/docbook/cayenne-guide/src/docbkx/part4.xml |   1 +
 .../src/docbkx/performance-tuning.xml           |  24 +-
 .../docbkx/persistent-objects-objectcontext.xml |   4 +-
 .../cayenne-guide/src/docbkx/queries.xml        |  40 +-
 .../cayenne-guide/src/docbkx/re-filtering.xml   | 457 ++++++++++---------
 .../src/docbkx/re-introduction.xml              | 116 +++--
 .../cayenne-guide/src/docbkx/re-modeler.xml     | 113 +++++
 .../src/docbkx/re-name-generator.xml            |  18 +-
 .../docbkx/re-relationships-loading-control.xml |  20 +-
 .../cayenne-guide/src/docbkx/re-table-types.xml |  22 +-
 .../src/docbkx/re-types-mapping.xml             | 104 +++--
 .../cayenne-guide/src/docbkx/rop-deployment.xml |   2 +-
 docs/docbook/cayenne-guide/src/docbkx/setup.xml |  64 ++-
 .../src/docbkx/starting-cayenne.xml             |   2 +-
 .../src/images/re-modeler-datasource-select.png | Bin 0 -> 32658 bytes
 .../re-modeler-reverseengineering-dialog.png    | Bin 0 -> 29936 bytes
 .../src/main/resources/css/cayenne-doc.css      |   8 +
 .../src/docbkx/index.xml                        |   2 +-
 .../src/docbkx/reverse-engineering-ch1.xml      | 378 ++++++++-------
 .../src/docbkx/reverse-engineering-ch2.xml      | 286 ++++++------
 .../getting-started-rop/src/docbkx/index.xml    |   2 +-
 .../getting-started/src/docbkx/index.xml        |   2 +-
 docs/docbook/pom.xml                            |   7 +-
 docs/docbook/upgrade-guide/src/docbkx/index.xml |   2 +-
 30 files changed, 1095 insertions(+), 818 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml b/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
index 6f3fb6c..6d76ef2 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/cayenne-mapping-structure.xml
@@ -29,13 +29,13 @@
             legacy reasons this naming convention is different from the convention for the root
             project descriptor above, and we may align it in the future versions. Here is how a
             typical project might look on the file
-            system:<programlisting>~: ls -l
+            system:<screen><prompt>$</prompt> <userinput>ls -l</userinput>
 total 24
 -rw-r--r--  1 cayenne  staff  491 Jan 28 18:25 cayenne-project.xml
--rw-r--r--  1 cayenne  staff  313 Jan 28 18:25 datamap.map.xml</programlisting></para>
+-rw-r--r--  1 cayenne  staff  313 Jan 28 18:25 datamap.map.xml</screen></para>
         <para>DataMap are referenced by name in the root
-            descriptor:<programlisting>&lt;map name="datamap"/></programlisting></para>
-        <para>Map files are resolved by Cayenne by appending <code>.map.xml</code>" extension to the
+            descriptor:<programlisting language="xml">&lt;map name="datamap"/></programlisting></para>
+        <para>Map files are resolved by Cayenne by appending "<code>.map.xml</code>" extension to the
             map name, and resolving the resulting string relative to the root descriptor URI. The
             following sections discuss varios ORM model objects, without regards to their XML
             representation. XML format details are really unimportant to the Cayenne users.</para>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml b/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
index 4e41174..4c6b9ae 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/cayennemodeler-application.xml
@@ -19,21 +19,75 @@
     <title>CayenneModeler Application</title>
     <section xml:id="working-with-mapping-projects">
         <title>Working with Mapping Projects</title>
+        <para></para>
     </section>
     <section xml:id="reverse-engineering-database">
         <title>Reverse Engineering Database</title>
+        <para>
+            See chapter <link linkend="re-modeler">Reverse Engineering in Cayenne Modeler</link>
+        </para>
     </section>
     <section xml:id="generating-database-schema">
         <title>Generating Database Schema</title>
+        <para>
+            With Cayenne Modeler you can create simple database schemas without any additional database tools.
+            This is a good option for initial database setup if you completely created you model with the Modeler.
+            You can start SQL schema generation by selecting menu
+            <emphasis role="strong">
+                <guimenu>Tools</guimenu> &gt; <guimenuitem>Generate Database Schema</guimenuitem>
+            </emphasis>
+        </para>
+        <para>
+            You can select what database parts should be generated and what tables you want
+        </para>
     </section>
     <section xml:id="migrations">
         <title>Migrations</title>
+        <para> </para>
     </section>
     <section xml:id="generating-java-classes">
         <title>Generating Java Classes</title>
+        <para>
+            Before using Cayenne in you code you need to generate java source code for persistent objects.
+            This can be done with Modeler GUI or via <link linkend="mvn-cgen">cgen</link> maven/ant plugin.
+        </para>
+        <para>
+            To generate classes in the modeler use
+            <emphasis role="strong">
+                <guimenu>Tools</guimenu> &gt; <guimenuitem>Generate Classes</guimenuitem>
+            </emphasis>
+        </para>
+        <para>
+            There is three default types of code generation
+            <itemizedlist>
+                <listitem>
+                    <para><emphasis role="strong">Standard Persistent Objects</emphasis></para>
+                    <para>
+                        Default type of generation suitable for almost all cases.
+                        Use this type unless you now what exactly you need to customize.
+                    </para>
+                </listitem>
+                <listitem>
+                    <para><emphasis role="strong">Client Persistent Objects</emphasis></para>
+                    <para>
+
+                    </para>
+                </listitem>
+                <listitem>
+                    <para><emphasis role="strong">Advanced.</emphasis></para>
+                    <para>
+                        In advanced mode you can control almost all aspects of code generation including custom templates for java code.
+                        See default Cayenne templates on
+                        <link xlink:href="https://github.com/apache/cayenne/tree/master/cayenne-tools/src/main/resources/templates/v1_2">GitHub</link>
+                        as an example
+                    </para>
+                </listitem>
+            </itemizedlist>
+        </para>
     </section>
     <section xml:id="modeling-inheritance">
         <title>Modeling Inheritance</title>
+        <para> </para>
     </section>
     <section xml:id="modeling-generic-persistence-classes">
         <title>Modeling Generic Persistent Classes</title>
@@ -53,8 +107,10 @@
     </section>
     <section xml:id="mapping-objattributes-to-custom-classes">
         <title>Mapping ObjAttributes to Custom Classes</title>
+        <para> </para>
     </section>
     <section xml:id="modeling-pk-generation-strategy">
         <title>Modeling Primary Key Generation Strategy</title>
+        <para> </para>
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml b/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
index 097d7d9..21719ce 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/customizing-cayenne-runtime.xml
@@ -184,7 +184,7 @@ binder.bind(Key.get(Service2.class, "i2")).to(Service2Impl.class);</programlisti
             This section shows all the configuration possibilities in detail, including changing
             properties of the existing services, contributing services to standard service lists and
             maps, and overriding service implementations. All the code examples later in this
-            section are assumed to be placed in an application module "configure" method:</para><programlisting>public class MyExtensionsModule implements Module {
+            section are assumed to be placed in an application module "configure" method:</para><programlisting language="java">public class MyExtensionsModule implements Module {
     public void configure(Binder binder) {
         // customizations go here...
     }
@@ -199,7 +199,7 @@ ServerRuntime runtime =
                 Supported property names are listed in "Appendix A".</para>
             <para>There are two ways to set service properties. The most obvious one is to pass it
                 to the JVM with -D flag on startup.
-                E.g.<programlisting>java -Dcayenne.server.contexts_sync_strategy=false ...</programlisting></para>
+                E.g.<screen><prompt>$</prompt> java -Dcayenne.server.contexts_sync_strategy=false ...</screen></para>
             <para>A second one is to contribute a property to
                     <code>org.apache.cayenne.configuration.DefaultRuntimeProperties.properties
                 </code>map (see the next section on how to do that). This map contains the default

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/expressions.xml b/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
index 7e34f71..01deb9c 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/expressions.xml
@@ -109,7 +109,7 @@
             understanding the semantics. A Cayenne expression can be represented as a String, which
             can be later converted to an expression object using <code>Expression.fromString</code>
             static method. Here is an
-            example:<programlisting>String expString = &quot;name like &apos;A%&apos; and price &lt; 1000&quot;;
+            example:<programlisting language="java">String expString = &quot;name like &apos;A%&apos; and price &lt; 1000&quot;;
 Expression exp = Expression.fromString(expString);</programlisting>This
             particular expression may be used to match Paintings with names that start with &quot;A&quot; and
             a price less than $1000. While this example is pretty self-explanatory, there are a few
@@ -120,13 +120,13 @@ Expression exp = Expression.fromString(expString);</programlisting>This
             may be other entities, for which this expression is valid. Now the expression details... </para>
         <para><emphasis role="italic">Character constants</emphasis> that are not paths or numeric values
             should be enclosed in single or double quotes. Two of the expressions below are
-            equivalent:<programlisting>name = &apos;ABC&apos;
+            equivalent:<programlisting language="SQL">name = &apos;ABC&apos;
 
 // double quotes are escaped inside Java Strings of course
 name = \&quot;ABC\&quot;</programlisting></para>
         <para><emphasis role="italic">Case sensitivity.</emphasis> Expression operators are all case
             sensitive and are usually lowercase. Complex words follow the java camel-case
-            style:<programlisting>// valid
+            style:<programlisting language="SQL">// valid
 name likeIgnoreCase &apos;A%&apos;
 
 // invalid - will throw a parse exception
@@ -138,7 +138,7 @@ name LIKEIGNORECASE &apos;A%&apos;</programlisting></para>
             optionally prefixed by &quot;obj:&quot; (usually they are not prefixed at all actually). Database
             expressions are always prefixed with &quot;db:&quot;. A special kind of prefix, not discussed yet
             is &quot;enum:&quot; that prefixes an enumeration
-            constant:<programlisting>// object path
+            constant:<programlisting language="SQL">// object path
 name = &apos;Salvador Dali&apos;
 
 // same object path - a rarely used form
@@ -156,13 +156,13 @@ name = enum:org.foo.EnumClass.VALUE1</programlisting></para>
             <emphasis role="italic">Binary conditions</emphasis> are expressions that contain a path
             on the left, a value on the right, and some operation between them, such as equals,
             like, etc. They can be used as qualifiers in
-                SelectQueries:<programlisting>name like &apos;A%&apos;</programlisting>
+                SelectQueries:<programlisting language="SQL">name like &apos;A%&apos;</programlisting>
             <emphasis role="italic">Named parameters.</emphasis> Expressions can have named parameters (names that
             start with &quot;$&quot;). Parameterized expressions allow to create reusable expression
             templates. Also if an Expression contains a complex object that doesn&apos;t have a simple
             String representation (e.g. a Date, a DataObject, an ObjectId), parameterizing such
             expression is the only way to represent it as String. Here are some
-            examples:<programlisting>Expression template = Expression.fromString(&quot;name = $name&quot;);
+            examples:<programlisting language="java">Expression template = Expression.fromString(&quot;name = $name&quot;);
 ...
 Map p1 = Collections.singletonMap(&quot;name&quot;, &quot;Salvador Dali&quot;);
 Expression qualifier1 = template.expWithParameters(p1);
@@ -171,19 +171,19 @@ Map p2 = Collections.singletonMap(&quot;name&quot;, &quot;Monet&quot;);
 Expression qualifier2 = template.expWithParameters(p2);</programlisting>To
             create a named parameterized expression with a LIKE clause, SQL wildcards must be part
             of the values in the Map and not the expression string
-            itself:<programlisting>Expression template = Expression.fromString(&quot;name like $name&quot;);
+            itself:<programlisting language="java">Expression template = Expression.fromString(&quot;name like $name&quot;);
 ...
 Map p1 = Collections.singletonMap(&quot;name&quot;, &quot;Salvador%&quot;);
 Expression qualifier1 = template.expWithParameters(p1);</programlisting>When
             matching on a relationship, parameters can be Persistent objects or
-            ObjectIds:<programlisting>Expression template = Expression.fromString(&quot;artist = $artist&quot;);
+            ObjectIds:<programlisting language="java">Expression template = Expression.fromString(&quot;artist = $artist&quot;);
 ...
 Artist dali = // asume we fetched this one already
 Map p1 = Collections.singletonMap(&quot;artist&quot;, dali);
 Expression qualifier1 = template.expWithParameters(p1);</programlisting>Uninitialized
             parameters will be automatically pruned from expressions, so a user can omit some
             parameters when creating an expression from a parameterized
-            template:<programlisting>Expression template = Expression.fromString(&quot;name like $name and dateOfBirth &gt; $date&quot;);
+            template:<programlisting language="java">Expression template = Expression.fromString(&quot;name like $name and dateOfBirth &gt; $date&quot;);
 ...
 Map p1 = Collections.singletonMap(&quot;name&quot;, &quot;Salvador%&quot;);
 Expression qualifier1 = template.expWithParameters(p1);
@@ -211,7 +211,7 @@ Expression qualifier1 = template.expWithParameters(p1);
             general examples and some gotchas. </para>
         <para>The following code recreates the expression from the previous chapter, but now using
             expression
-            API:<programlisting>// String expression: name like &apos;A%&apos; and price &lt; 1000
+            API:<programlisting language="java">// String expression: name like &apos;A%&apos; and price &lt; 1000
 Expression e1 = ExpressionFactory.likeExp(Painting.NAME_PROPERTY, &quot;A%&quot;);
 Expression e2 = ExpressionFactory.lessExp(Painting.PRICE_PROPERTY, 1000);
 Expression finalExp = e1.andExp(e2); </programlisting>This
@@ -227,7 +227,7 @@ Expression finalExp = e1.andExp(e2); </programlisting>This
             control how SQL joins are generated if the same path is encountered more than once in
             the same Expression. Two ExpressionFactory methods allow to implicitly generate aliases
             to &quot;split&quot; match paths into individual joins if
-            needed:<programlisting>Expression matchAllExp(String path, Collection values)
+            needed:<programlisting language="java">Expression matchAllExp(String path, Collection values)
 Expression matchAllExp(String path, Object... values)</programlisting></para>
         <para>&quot;Path&quot; argument to both of these methods can use a split character (a pipe symbol &apos;|&apos;)
             instead of dot to indicate that relationship following a path should be split into a
@@ -243,16 +243,16 @@ Expression matchAllExp(String path, Object... values)</programlisting></para>
             is done by the database engine. However the same expressions can also be used for
             accessing object properties, calculating values, in-memory filtering. </para>
         <para>Checking whether an object satisfies an
-            expression:<programlisting>Expression e = ExpressionFactory.inExp(User.NAME_PROPERTY, &quot;John&quot;, &quot;Bob&quot;);
+            expression:<programlisting language="java">Expression e = ExpressionFactory.inExp(User.NAME_PROPERTY, &quot;John&quot;, &quot;Bob&quot;);
 User user = ...
 if(e.match(user)) {
    ...
 }</programlisting>Reading
             property
-            value:<programlisting>Expression e = Expression.fromString(User.NAME_PROPERTY);
+            value:<programlisting language="java">Expression e = Expression.fromString(User.NAME_PROPERTY);
 String name = e.evaluate(user);</programlisting></para>
         <para>Filtering a list of
-            objects:<programlisting>Expression e = ExpressionFactory.inExp(User.NAME_PROPERTY, &quot;John&quot;, &quot;Bob&quot;);
+            objects:<programlisting language="java">Expression e = ExpressionFactory.inExp(User.NAME_PROPERTY, &quot;John&quot;, &quot;Bob&quot;);
 List&lt;User&gt; unfiltered = ...
 List&lt;User&gt; filtered = e.filterObjects(unfiltered);</programlisting></para>
         <para>
@@ -270,7 +270,7 @@ List&lt;User&gt; filtered = e.filterObjects(unfiltered);</programlisting></para>
             In some situations, it is convenient to be able to convert Expression instances into EJBQL.
             Expressions support this conversion.  An example is shown below.
 
-            <programlisting>String serial = ...
+            <programlisting language="java">String serial = ...
 Expression e = ExpressionFactory.matchExp(Pkg.SERIAL_PROPERTY, serial);
 List&lt;Object&gt; params = new ArrayList&lt;Object&gt;();
 EJBQLQuery query = new EJBQLQuery("SELECT p FROM Pkg p WHERE " + e.toEJBQL(params,&quot;p&quot;);
@@ -281,7 +281,7 @@ for(int i=0;i&lt;params.size();i++) {
 
             This would be equivalent to the following purely EJBQL querying logic;
 
-            <programlisting>EJBQLQuery query = new EJBQLQuery("SELECT p FROM Pkg p WHERE p.serial = ?1");
+            <programlisting language="java">EJBQLQuery query = new EJBQLQuery("SELECT p FROM Pkg p WHERE p.serial = ?1");
 query.setParameter(1,serial);</programlisting>
         </para>
     </section>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml b/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
index ae7f81a..307a16c 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/including-cayenne-in-project.xml
@@ -22,19 +22,19 @@
         <para>Cayenne distribution contains the following core runtime jars in the distribution
                 <code>lib</code> directory: <itemizedlist>
                 <listitem>
-                    <para><emphasis role="italic">cayenne-server-x.x.jar</emphasis> - contains full
+                    <para><emphasis role="italic">cayenne-server-<?eval ${project.version}?>.jar</emphasis> - contains full
                         Cayenne runtime (DI, adapters, DB access classes, etc.). Most applications
                         will use only this file.</para>
                 </listitem>
                 <listitem>
-                    <para>cayenne-client-x.x.jar - a subset of cayenne-server.jar trimmed for use on
+                    <para>cayenne-client-<?eval ${project.version}?>.jar - a subset of cayenne-server.jar trimmed for use on
                         the client in an ROP application.</para>
                 </listitem>
                 <listitem>
                     <para>Other cayenne-* jars - various Cayenne extensions.</para>
                 </listitem>
             </itemizedlist></para>
-        <para>When using <code>cayenne-server-x.x.jar</code> you'll need a few third party jars (all
+        <para>When using <code>cayenne-server-<?eval ${project.version}?>.jar</code> you'll need a few third party jars (all
             included in <code>lib/third-party</code> directory of the distribution): <itemizedlist>
                 <listitem>
                     <para><link xlink:href="http://velocity.apache.org/">Apache Velocity
@@ -58,10 +58,10 @@
         <title>Maven Projects</title>
         <para>If you are using Maven, you won't have to deal with figuring out the dependencies. You
             can simply include cayenne-server artifact in your
-            POM:<programlisting>&lt;dependency>
+            POM:<programlisting language="xml">&lt;dependency>
    &lt;groupId>org.apache.cayenne&lt;/groupId>
    &lt;artifactId>cayenne-server&lt;/artifactId>
-   &lt;version>X.Y.Z&lt;/version>
+   &lt;version><?eval ${project.version}?>&lt;/version>
 &lt;/dependency></programlisting></para>
         <para>Additionally Cayenne provides a Maven plugin with a set of goals to perform various project
             tasks, such as synching generated Java classes with the mapping, described in the
@@ -232,10 +232,10 @@
                     </tbody>
                 </table> Example - a typical class generation scenario, where pairs of classes are
                 generated with default Maven source destination and superclass
-                package:<programlisting>&lt;plugin>
+                package:<programlisting language="xml">&lt;plugin>
     &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
     &lt;artifactId>maven-cayenne-plugin&lt;/artifactId>
-    &lt;version>X.Y.Z&lt;/version>
+    &lt;version><?eval ${project.version}?>&lt;/version>
 
     &lt;configuration>
         &lt;map>${project.basedir}/src/main/resources/my.map.xml&lt;/map>
@@ -353,10 +353,10 @@
 				</table>
 			</para>
 			<para>Example - creating a DB schema on a local HSQLDB
-				database:<programlisting>&lt;plugin>
+				database:<programlisting language="xml">&lt;plugin>
     &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
     &lt;artifactId>maven-cayenne-plugin&lt;/artifactId>
-    &lt;version>X.Y.Z&lt;/version>
+    &lt;version><?eval ${project.version}?>&lt;/version>
     &lt;executions>
         &lt;execution>
             &lt;configuration>
@@ -378,8 +378,9 @@
 			<para><code>cdbimport</code> is a <code>maven-cayenne-plugin</code> goal that generates a DataMap
 				based on an existing database schema. By default, it is bound to the
 				generate-sources phase. This allows you to generate your DataMap prior to building
-				your project, possibly followed by "cgen" execution to generate the classes.<table
-					frame="void">
+				your project, possibly followed by "cgen" execution to generate the classes.
+				CDBImport plugin described in details in chapter <link linkend="re-introduction">Reverse Engineering</link>
+				<table frame="void">
 					<caption>cdbimport required parameters</caption>
 					<col width="14%"/>
 					<col width="7%"/>
@@ -441,13 +442,6 @@
 								to guess the DB type.</td>
 						</tr>
 						<tr>
-							<td><code>catalog</code></td>
-							<td>String</td>
-							<td>A database catalog to import tables/stored procedures from. This can
-								be a pattern in the format supported by
-								DatabaseMetadata.getTables(). I.e. it can contain '%' wildcard.</td>
-						</tr>
-						<tr>
 							<td><code>defaultPackage</code></td>
 							<td>String</td>
 							<td>A Java package that will be set as the imported DataMap default and
@@ -457,29 +451,24 @@
 								no package, and will not compile.</td>
 						</tr>
 						<tr>
-							<td><code>excludeTables</code></td>
-							<td>boolean</td>
-							<td>A comma-separated list of Perl5 patterns that defines which table names should be skipped
-								during the import. This (together with 'includeTables') is the most
-								flexible way to filter the table list. Another way to filter it is
-								via "tablePattern" that is limited to filtering with a single
-								wildcard pattern as defined in DatabaseMetadata.getTables().</td>
-						</tr>
-						<tr>
-							<td><code>includeTables</code></td>
+							<td><code>forceDataMapCatalog</code></td>
 							<td>boolean</td>
-							<td>A comma-separated list of Perl5 patterns that defines which table names should be
-								included during the import. Additionally matching tables will be
-								compared with "excludeTables" pattern. If they match include and
-								exclude, they will be skipped. Another way to filter it is via
-								"tablePattern" that is limited to filtering with a single wildcard
-								pattern as defined in DatabaseMetadata.getTables().</td>
+							<td>
+								Automatically tagging each DbEntity with the actual DB catalog/schema (default behavior)
+								may some time be undesirable. If this is the case then setting <code>forceDataMapCatalog</code>
+								to <code>true</code> will set DbEntity catalog to one in the DataMap.
+								Default value <code>false</code>.
+							</td>
 						</tr>
 						<tr>
-							<td><code>importProcedures</code></td>
+							<td><code>forceDataMapSchema</code></td>
 							<td>boolean</td>
-							<td>Indicates whether stored procedures should be imported from the
-								database. Default is false. </td>
+							<td>
+								Automatically tagging each DbEntity with the actual DB catalog/schema (default behavior)
+								may some time be undesirable. If this is the case then setting <code>forceDataMapSchema</code>
+								to <code>true</code> will set DbEntity schema to one in the DataMap.
+								Default value <code>false</code>.
+							</td>
 						</tr>
 						<tr>
 							<td><code>meaningfulPkTables</code></td>
@@ -491,41 +480,56 @@
 						<tr>
 							<td><code>namingStrategy</code></td>
 							<td>String</td>
-							<td>The naming strategy used for mapping database names to object entity
-								names. Default is
-									<code>org.apache.cayenne.map.naming.SmartNameGenerator</code>.
+							<td>
+								The naming strategy used for mapping database names to object entity
+								names. Default is <code>org.apache.cayenne.dbsync.naming.DefaultObjectNameGenerator</code>.
 							</td>
 						</tr>
 						<tr>
-							<td><code>overwrite</code></td>
-							<td>boolean</td>
-							<td>If true (default), deletes all existing mappings before starting scheman import. If
-								false, already existing entities are preserved.</td>
-						</tr>
-						<tr>
 							<td><code>password</code></td>
 							<td>String</td>
 							<td>Database user password.</td>
 						</tr>
-						<tr>
-							<td><code>procedurePattern</code></td>
-							<td>String</td>
-							<td>Pattern to match stored procedure names against for import. Default
-								is to match all stored procedures. This value is only meaningful if
-								importProcedures is true. </td>
-						</tr>
-						<tr>
-							<td><code>schema</code></td>
-							<td>String</td>
-							<td>A database schema to import tables/stored procedures from. This can
-								be a pattern in the format supported by
-								DatabaseMetadata.getTables(). I.e. it can contain '%' wildcard.</td>
+						<tr xml:id="cdbimport-rr-parameter">
+							<td><code>reverseEngineering</code></td>
+							<td>XML</td>
+							<td>
+								An object that contains detailed reverse engineering rules about
+								what DB objects should be processed.
+								For full information about this parameter see
+								<link linkend="re-introduction">reverse engineering</link> chapter.
+								Here is some simple example:
+								<programlisting language="xml">&lt;reverseEngineering&gt;
+	&lt;skipRelationshipsLoading&gt;false&lt;/skipRelationshipsLoading&gt;
+	&lt;skipPrimaryKeyLoading&gt;false&lt;/skipPrimaryKeyLoading&gt;
+
+	&lt;catalog name="test_catalog"&gt;
+		&lt;schema name="test_schema"&gt;
+			&lt;includeTable pattern=".*"/&gt;
+			&lt;excludeTable&gt;test_table&lt;/excludeTable&gt;
+		&lt;/schema&gt;
+	&lt;/catalog&gt;
+
+	&lt;includeProcedure pattern=".*"/&gt;
+&lt;/reverseEngineering&gt;</programlisting>
+
+							</td>
 						</tr>
 						<tr>
-							<td><code>tablePattern</code></td>
+							<td><code>stripFromTableNames</code></td>
 							<td>String</td>
-							<td>Pattern to match table names against for import. Default is to match
-								all tables. </td>
+							<td>
+								Regex that matches the part of the table name that needs to be stripped off.
+								Here is some examples:
+								<programlisting language="xml"><![CDATA[<!-- Strip prefix -->
+<stripFromTableNames>^myt_</stripFromTableNames>
+
+<!-- Strip suffix -->
+<stripFromTableNames>_s$</stripFromTableNames>
+
+<!-- Strip multiple occurrences in the middle -->
+<stripFromTableNames>_abc</stripFromTableNames>]]></programlisting>
+							</td>
 						</tr>
 						<tr>
 							<td><code>username</code></td>
@@ -544,10 +548,10 @@
 			</para>
 			<para>Example - loading a DB schema from a local HSQLDB database (essentially a reverse operation
 				compared to the cdbgen example above)
-				:<programlisting>&lt;plugin>
+				:<programlisting language="xml">&lt;plugin>
     &lt;groupId>org.apache.cayenne.plugins&lt;/groupId>
     &lt;artifactId>maven-cayenne-plugin&lt;/artifactId>
-    &lt;version>X.Y.Z&lt;/version>
+    &lt;version><?eval ${project.version}?>&lt;/version>
 
     &lt;executions>
         &lt;execution>
@@ -578,7 +582,7 @@
             <title>cdbimport</title>
             <para>This is an Ant counterpart of "cdbimport" goal of maven-cayenne-plugin described
                 above. It has exactly the same properties. Here is a usage
-                example:<programlisting> &lt;cdbimport map="${context.dir}/WEB-INF/my.map.xml"
+                example:<programlisting language="xml"> &lt;cdbimport map="${context.dir}/WEB-INF/my.map.xml"
     driver="com.mysql.jdbc.Driver" 
     url="jdbc:mysql://127.0.0.1/mydb" 
     username="sa"

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/index.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/index.xml b/docs/docbook/cayenne-guide/src/docbkx/index.xml
index 048bfca..b3dc9f2 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/index.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/index.xml
@@ -15,11 +15,12 @@
     License.
 -->
 <book xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
-    xml:id="cayenne-guide" xmlns:xi="http://www.w3.org/2001/XInclude">
+      xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      xsi:schemaLocation="http://docbook.org/xml/5.0/xsd/docbook.xsd" xml:id="cayenne-guide">
     <info>
         <title>Cayenne Guide</title>
         <copyright>
-            <year>2011-2014</year>
+            <year>2011-<?dbtimestamp format="Y"?></year>
             <holder>Apache Software Foundation and individual authors</holder>
         </copyright>
         <legalnotice>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/part4.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/part4.xml b/docs/docbook/cayenne-guide/src/docbkx/part4.xml
index e6d2a45..9f15bbd 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/part4.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/part4.xml
@@ -23,4 +23,5 @@
 	<xi:include href="re-name-generator.xml"/>
 	<xi:include href="re-table-types.xml"/>
 	<xi:include href="re-types-mapping.xml"/>
+	<xi:include href="re-modeler.xml"/>
 </part>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml b/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
index 41f2d98..d7a12c5 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/performance-tuning.xml
@@ -116,7 +116,7 @@ PrefetchTreeNode.DISJOINT_BY_ID_PREFETCH_SEMANTICS</programlisting></para>
             <link linkend="ejbqlquery">EJBQLQuery</link> queries by employing the &quot;FETCH&quot;
                 keyword.</para>
 
-            <screen>SELECT a FROM Artist a LEFT JOIN FETCH a.paintings</screen>
+            <programlisting language="sql">SELECT a FROM Artist a LEFT JOIN FETCH a.paintings</programlisting>
 
             <para>
                 In this case, the Paintings that exist for the Artist will be obtained at the same time
@@ -165,12 +165,12 @@ for(DataRow row : rows) {
             The following example would return a java.util.List of String objects;
         </para>
 
-        <screen>SELECT a.name FROM Artist a</screen>
+        <programlisting language="sql">SELECT a.name FROM Artist a</programlisting>
 
         <para>The following will yield a java.util.List containing Object[] instances, each of which
             would contain the name followed by the dateOfBirth value.</para>
 
-        <screen>SELECT a.name, a.dateOfBirth FROM Artist a</screen>
+        <programlisting language="sql">SELECT a.name, a.dateOfBirth FROM Artist a</programlisting>
 
         <para>Refer to third-party query language documentation for further
             detail on this mechanism.</para>
@@ -204,7 +204,7 @@ for(DataRow row : rows) {
     }           
 }</programlisting></para>
         <para>Same thing with a
-            callback:<programlisting>ObjectSelect.query(Artist.class).iterate(context, (Artist a) -> {
+            callback:<programlisting language="java">ObjectSelect.query(Artist.class).iterate(context, (Artist a) -> {
     // do something with the object...
     ...
 });</programlisting></para>
@@ -212,7 +212,7 @@ for(DataRow row : rows) {
             each iteration. This is a common scenario in various data processing jobs - read a batch
             of objects, process them, commit the results, and then repeat. This allows to further
             optimize processing (e.g. by avoiding frequent
-            commits).<programlisting>try(ResultBatchIterator&lt;Artist> it = ObjectSelect.query(Artist.class).iterator(context)) {
+            commits).<programlisting language="java">try(ResultBatchIterator&lt;Artist> it = ObjectSelect.query(Artist.class).iterator(context)) {
     for(List&lt;Artist> list : it) {
        // do something with each list
        ...
@@ -265,7 +265,7 @@ List&lt;Artist> artists =
             <para>To take advantage of query result caching, the first step is to mark your queries
                 appropriately. Here is an example for ObjectSelect query. Other types of queries
                 have similar
-                API:<programlisting>ObjectSelect.query(Artist.class).localCache("artists");</programlisting></para>
+                API:<programlisting language="java">ObjectSelect.query(Artist.class).localCache("artists");</programlisting></para>
             <para>This tells Cayenne that the query created here would like to use local cache of
                 the context it is executed against. A vararg parameter to <code>localCache()</code>
                 (or <code>sharedCache()</code>) method contains so called "cache groups". Those are
@@ -277,7 +277,7 @@ List&lt;Artist> artists =
                 providers. One such provider available in Cayenne is a provider for <link
                     xlink:href="http://www.ehcache.org/">EhCache</link>. It can be enabled on
                 ServerRuntime startup in a custom
-                Module:<programlisting>ServerRuntimeBuilder
+                Module:<programlisting language="java">ServerRuntimeBuilder
   .builder()
   .addModule((binder) -> 
      binder.bind(QueryCache.class).to(EhCacheQueryCache.class)
@@ -285,7 +285,7 @@ List&lt;Artist> artists =
   .build();</programlisting></para>
             <para>By default EhCache reads a file called "ehcache.xml" located on classpath. You can
                 put your cache configuration in that file.
-                E.g.:<programlisting>&lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                E.g.:<programlisting language="xml">&lt;ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="false"
 	monitoring="off" dynamicConfig="false">
 
@@ -302,7 +302,7 @@ List&lt;Artist> artists =
                 sufficient, and the users want real-time cache invalidation when the data changes.
                 So in addition to those policies, the app can invalidate individual cache groups
                 explicitly with
-                <code>RefreshQuery</code>:<programlisting>RefreshQuery refresh = new RefreshQuery("artist");
+                <code>RefreshQuery</code>:<programlisting language="java">RefreshQuery refresh = new RefreshQuery("artist");
 context.performGenericQuery(refresh);</programlisting></para>
             <para>The above can be used e.g. to build UI for manual cache invalidation. It is also
                 possible to automate cache refresh when certain entities are committed. This
@@ -310,7 +310,7 @@ context.performGenericQuery(refresh);</programlisting></para>
                 you will need two things: <code>@CacheGroups</code> annotation to mark entities that
                 generate cache invalidation events and �<code>CacheInvalidationFilter</code> that
                 catches the updates to the annotated objects and generates appropriate invalidation
-                events:<programlisting>// configure filter on startup
+                events:<programlisting language="java">// configure filter on startup
 ServerRuntimeBuilder
   .builder()
   .addModule((binder) -> 
@@ -319,7 +319,7 @@ ServerRuntimeBuilder
   .build();</programlisting></para>
             <para>Now you can associate entities with cache groups, so that commits to those
                 entities would atomatically invalidate the
-                groups:<programlisting>@CacheGroups("artists")
+                groups:<programlisting language="java">@CacheGroups("artists")
 public class Artist extends _Artist {
 }</programlisting></para>
             <para>Finally you may cluster cache group events. They are very small and can be
@@ -366,7 +366,7 @@ public class Artist extends _Artist {
             To do that, set to "false" the following DI property -
                 <code>Constants.SERVER_CONTEXTS_SYNC_PROPERTY</code>, using one of the standard
             Cayenne DI approaches. E.g. from command
-            line:<programlisting language="java">java -Dcayenne.server.contexts_sync_strategy=false</programlisting>Or
+            line:<screen><prompt>$</prompt> java -Dcayenne.server.contexts_sync_strategy=false</screen>Or
             by changing the standard properties Map in a custom extensions
             module:<programlisting language="java">public class MyModule implements Module {
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml b/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
index 404cab1..6305c9a 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/persistent-objects-objectcontext.xml
@@ -267,7 +267,7 @@ generic.writeProperty("name", "New Name");</programlisting>This
             that spans more than one Cayenne operation. E.g. two sequential commits that need to be
             rolled back together in case of failure. This can be done via
                 <code>ServerRuntime.performInTransaction</code>
-            method:<programlisting>Integer result = runtime.performInTransaction(() -> {
+            method:<programlisting language="java">Integer result = runtime.performInTransaction(() -> {
     // commit one or more contexts
     context1.commitChanges();
     context2.commitChanges();
@@ -282,7 +282,7 @@ generic.writeProperty("name", "New Name");</programlisting>This
         <para>When inside the transaction, current thread Transaction object can be accessed via a
             static method. E.g. here is an example that initializes transaction JDBC connection with
             a custom connection object
-            :<programlisting>Transaction tx = BaseTransaction.getThreadTransaction();
+            :<programlisting language="java">Transaction tx = BaseTransaction.getThreadTransaction();
 tx.addConnection("mydatanode", myConnection); </programlisting></para>
     </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/queries.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/queries.xml b/docs/docbook/cayenne-guide/src/docbkx/queries.xml
index 2b3b580..37254d4 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/queries.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/queries.xml
@@ -50,8 +50,8 @@
             query:<programlisting language="java">List&lt;Artist> objects = ObjectSelect.query(Artist.class).select(context);</programlisting>This
             returned all rows in the "ARTIST" table. If the logs were turned on, you might see the
             following SQL
-            printed:<programlisting language="java">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
-INFO: === returned 5 row. - took 5 ms.</programlisting></para>
+            printed:<screen>INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0
+INFO: === returned 5 row. - took 5 ms.</screen></para>
         <para>This SQL was generated by Cayenne from the ObjectSelect above. ObjectSelect can have a
             qualifier to select only the data matching specific criteria. Qualifier is simply an
             Expression (Expressions where discussed in the previous chapter), appended to the query
@@ -61,9 +61,9 @@ INFO: === returned 5 row. - took 5 ms.</programlisting></para>
         .where(Artist.NAME.like("Pablo%"))
         .select(context);</programlisting>The
             SQL will look different this
-            time:<programlisting language="java">INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME LIKE ?
+            time:<screen>INFO: SELECT t0.DATE_OF_BIRTH, t0.NAME, t0.ID FROM ARTIST t0 WHERE t0.NAME LIKE ?
 [bind: 1->NAME:'Pablo%']
-INFO: === returned 1 row. - took 6 ms.</programlisting></para>
+INFO: === returned 1 row. - took 6 ms.</screen></para>
         <para>ObjectSelect allows to assemble qualifier from parts, using "and" and "or" method to
             chain then
             together:<programlisting language="java">List&lt;Artist> objects = ObjectSelect.query(Artist.class)
@@ -120,28 +120,26 @@ List&lt;String> names = context.performQuery(query);</programlisting>
             example would require three individual positional parameters (named
             parameters could also have been used) to be supplied.
 
-            <screen>select p from Painting p where p.paintingTitle in (?1,?2,?3)</screen>
+            <programlisting language="sql">select p from Painting p where p.paintingTitle in (?1,?2,?3)</programlisting>
 
             The following example requires a single positional parameter to be supplied.  The
             parameter can be any concrete implementation of the java.util.Collection interface such as
             java.util.List or java.util.Set.
 
-            <screen>select p from Painting p where p.paintingTitle in ?1</screen>
+            <programlisting language="sql">select p from Painting p where p.paintingTitle in ?1</programlisting>
 
             The following example is functionally identical to the one prior.
 
-            <screen>select p from Painting p where p.paintingTitle in (?1)</screen>
+            <programlisting language="sql">select p from Painting p where p.paintingTitle in (?1)</programlisting>
 
+            </para>
             <para>
-                It is
-                <link linkend="expressions-to-ejbql">possible to convert</link>
-                an
-                <link linkend="expressions">Expression</link>
-                object used with a
-                <link linkend="selectquery">SelectQuery</link>
+                It is <link linkend="expressions-to-ejbql">possible to convert</link>
+                an <link linkend="expressions">Expression</link>
+                object used with a <link linkend="selectquery">SelectQuery</link>
                 to EJBQL.  Use the Expression#appendAsEJBQL methods for this purpose.
             </para>
-
+            <para>
             While
             Cayenne Expressions discussed previously can be thought of as identical to JPQL WHERE
             clause, and indeed they are very close, there are a few noteable differences:
@@ -278,7 +276,7 @@ query.setParameters(Collections.singletonMap("tableName", "mydb.PAINTING"));
 #bind($xyz 'VARCHAR')
 #bind($xyz 'DECIMAL' 2)</programlisting></para>
                 <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">update ARTIST set NAME = #bind($name) where ID = #bind($id)</programlisting></para>
+                    example:</emphasis><programlisting language="sql">update ARTIST set NAME = #bind($name) where ID = #bind($id)</programlisting></para>
             </section>
             <section>
                 <title>#bindEqual</title>
@@ -303,7 +301,7 @@ query.setParameters(Collections.singletonMap("tableName", "mydb.PAINTING"));
 #bindEqual($xyz 'VARCHAR')
 #bindEqual($xyz 'DECIMAL' 2)</programlisting></para>
                 <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">update ARTIST set NAME = #bind($name) where ID #bindEqual($id)</programlisting></para>
+                    example:</emphasis><programlisting language="sql">update ARTIST set NAME = #bind($name) where ID #bindEqual($id)</programlisting></para>
             </section>
             <section>
                 <title>#bindNotEqual</title>
@@ -321,7 +319,7 @@ query.setParameters(Collections.singletonMap("tableName", "mydb.PAINTING"));
 #bindNotEqual($xyz 'VARCHAR')
 #bindNotEqual($xyz 'DECIMAL' 2)</programlisting></para>
                 <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">update ARTIST set NAME = #bind($name) where ID #bindEqual($id)</programlisting></para>
+                    example:</emphasis><programlisting language="sql">update ARTIST set NAME = #bind($name) where ID #bindEqual($id)</programlisting></para>
             </section>
             <section>
                 <title>#bindObjectEqual</title>
@@ -427,7 +425,7 @@ select.setParameters(Collections.singletonMap("a", a)); </programlisting></para>
 #result('DOB' 'java.util.Date' '' 'artist.DATE_OF_BIRTH') 
 #result('SALARY' 'float') </programlisting></para>
                 <para><emphasis role="italic">Full
-                    example:</emphasis><programlisting language="java">SELECT #result('ID' 'int'), #result('NAME' 'String'), #result('DATE_OF_BIRTH' 'java.util.Date') FROM ARTIST</programlisting></para>
+                    example:</emphasis><programlisting language="sql">SELECT #result('ID' 'int'), #result('NAME' 'String'), #result('DATE_OF_BIRTH' 'java.util.Date') FROM ARTIST</programlisting></para>
             </section>
             <section>
                 <title>#chain and #chunk</title>
@@ -451,8 +449,8 @@ select.setParameters(Collections.singletonMap("a", a)); </programlisting></para>
 #chunk(param) ... #end </programlisting></para>
                     <para><emphasis role="italic">Full
                     example:</emphasis><programlisting language="java">#chain('OR' 'WHERE') 
-	#chunk($name) NAME LIKE #bind($name) #end" 
-	#chunk($id) ARTIST_ID > #bind($id) #end" 
+	#chunk($name) NAME LIKE #bind($name) #end
+	#chunk($id) ARTIST_ID > #bind($id) #end
 #end" </programlisting></para>
           
             </section>
@@ -474,7 +472,7 @@ List&lt;Artist> artists = context.performQuery(query);</programlisting>Just
                 useful with SQLTemplate, as the result type most often than not does not represent a
                 Cayenne entity, but instead may be some aggregated report or any other data whose
                 object structure is opaque to
-                Cayenne:<programlisting language="java">String sql = SELECT t0.NAME, COUNT(1) FROM ARTIST t0 JOIN PAINTING t1 ON (t0.ID = t1.ARTIST_ID) "
+                Cayenne:<programlisting language="java">String sql = "SELECT t0.NAME, COUNT(1) FROM ARTIST t0 JOIN PAINTING t1 ON (t0.ID = t1.ARTIST_ID) "
     + "GROUP BY t0.NAME ORDER BY COUNT(1)";
 SQLTemplate query = new SQLTemplate(Artist.class, sql);
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml b/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
index b36c7f2..930448b 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-filtering.xml
@@ -21,38 +21,40 @@
             Basic syntax is described below:
         </para>
         <programlisting language="xml">
-            &lt;!-- Ant/Maven in case you only want to specify the schema to import --&gt;
-            &lt;schema&gt;SCHEMA_NAME&lt;/schema&gt;
-
-            &lt;!-- Maven way in case you have nested elements in the schema  --&gt;
-            &lt;schema&gt;
-                &lt;name&gt;SCHEMA_NAME&lt;/name&gt;
-                ...
-            &lt;/schema&gt;
-
-            &lt;!-- Ant way in case you have nested elements in the schema --&gt;
-            &lt;schema name="SCHEMA_NAME"&gt;
-                ...
-            &lt;/schema&gt;
+    &lt;!-- Ant/Maven in case you only want to specify the schema to import --&gt;
+    &lt;schema&gt;SCHEMA_NAME&lt;/schema&gt;
+
+    &lt;!-- Maven way in case you have nested elements in the schema  --&gt;
+    &lt;schema&gt;
+        &lt;name&gt;SCHEMA_NAME&lt;/name&gt;
+        ...
+    &lt;/schema&gt;
+
+    &lt;!-- Ant way in case you have nested elements in the schema --&gt;
+    &lt;schema name="SCHEMA_NAME"&gt;
+        ...
+    &lt;/schema&gt;
         </programlisting>
         <para>
             The same options are available for catalogs:
         </para>
         <programlisting language="xml">
-            &lt;!-- Ant/Maven in case you only want to specify the catalog to import --&gt;
-            &lt;catalog&gt;CATALOG_NAME&lt;/catalog&gt;
-            
-            &lt;!-- Maven way in case you have nested elements in the catalog --&gt;
-            &lt;catalog&gt;
-                &lt;name&gt;CATALOG_NAME&lt;/name&gt;
-                ...
-            &lt;/catalog&gt;
-
-            &lt;!-- Ant way in case you have nested elements in the catalog --&gt;
-                &lt;catalog name="CATALOG_NAME"&gt;
-                ...
-            &lt;/catalog&gt;
-        </programlisting>
+    &lt;!-- Ant/Maven in case you only want to specify the catalog to import --&gt;
+    &lt;catalog&gt;CATALOG_NAME&lt;/catalog&gt;
+
+    &lt;!-- Maven way in case you have nested elements in the catalog --&gt;
+    &lt;catalog&gt;
+        &lt;name&gt;CATALOG_NAME&lt;/name&gt;
+        ...
+    &lt;/catalog&gt;
+
+    &lt;!-- Ant way in case you have nested elements in the catalog --&gt;
+    &lt;catalog name="CATALOG_NAME"&gt;
+        ...
+    &lt;/catalog&gt;</programlisting>
+        <note>
+            <para>Current version of reverse engineering doesn't support catalog filtering for Postgres database.</para>
+        </note>
     </section>
     <section xml:id="combine-schema-catalog">
         <title>Combine Schema and Catalog filters</title>
@@ -60,31 +62,32 @@
             Cayenne supports combination of different schemas and catalogs, and it filters data according to your requirements. 
             You could achieve this by the following example of reverse engineering configuration:
         </para>
-        <programlisting language="xml">
-            &lt;configuration&gt;
-                ...
-                &lt;reverseEngineering&gt;
-                
-                    &lt;catalog name="shop_01"&gt;
-                        &lt;schema name="schema-name-01"/&gt;
-                        &lt;schema name="schema-name-02"/&gt;
-                        &lt;schema name="schema-name-03"/&gt;
-                    &lt;/catalog&gt;
-
-                    &lt;catalog name="shop_02"&gt;
-                        &lt;schema name="schema-name-01"/&gt;
-                    &lt;/catalog&gt;
-
-                    &lt;catalog name="shop_03"&gt;
-                        &lt;schema name="schema-name-01"/&gt;
-                        &lt;schema name="schema-name-02"/&gt;
-                        &lt;schema name="schema-name-03"/&gt;
-                    &lt;/catalog&gt;
-                    
-                &lt;/reverseEngineering&gt;
-                ...
-            &lt;/configuration&gt;
-        </programlisting>
+        <programlisting language="xml">&lt;configuration&gt;
+        ...
+    &lt;reverseEngineering&gt;
+
+        &lt;catalog&gt;
+            &lt;name>shop_01&lt;/name&gt;
+            &lt;schema&gt;schema-name-01&lt;/schema&gt;
+            &lt;schema&gt;schema-name-02&lt;/schema&gt;
+            &lt;schema&gt;schema-name-03&lt;/schema&gt;
+        &lt;/catalog&gt;
+
+        &lt;catalog&gt;
+            &lt;name>shop_02&lt;/name&gt;
+            &lt;schema&gt;schema-name-01&lt;/schema&gt;
+        &lt;/catalog&gt;
+
+        &lt;catalog&gt;
+            &lt;name>shop_03&lt;/name&gt;
+            &lt;schema&gt;schema-name-01&lt;/schema&gt;
+            &lt;schema&gt;schema-name-02&lt;/schema&gt;
+            &lt;schema&gt;schema-name-03&lt;/schema&gt;
+        &lt;/catalog&gt;
+
+    &lt;/reverseEngineering&gt;
+    ...
+&lt;/configuration&gt;</programlisting>
         <para>
             In the example above, Cayenne reverse engineering process contains three catalogs named as shop_01, shop_02 and shop_03, 
             each of wich has their own schemas. Cayenne will load all data only from the declared catalogs and schemas.
@@ -92,138 +95,137 @@
         <para>
             If you want to load everything from database, you could simply declare catalog specification alone.
         </para>
-        <programlisting language="xml">
-            &lt;configuration&gt;
-                ...
-                &lt;reverseEngineering&gt;
-                
-                    &lt;catalog name="shop_01"/&gt;
-                    &lt;catalog name="shop_02"/&gt;
-                    &lt;catalog name="shop_03"/&gt;
-
-                &lt;/reverseEngineering&gt;
-                ...
-            &lt;/configuration&gt;
-        </programlisting>
+        <programlisting language="xml">&lt;configuration&gt;
+    ...
+    &lt;reverseEngineering&gt;
+
+        &lt;catalog&gt;shop_01&lt;/catalog&gt;
+        &lt;catalog&gt;shop_02&lt;/catalog&gt;
+        &lt;catalog&gt;shop_03&lt;/catalog&gt;
+
+    &lt;/reverseEngineering&gt;
+    ...
+&lt;/configuration&gt;</programlisting>
         <para>
             If you want to do reverse engineering for specific schemas, just remove unwanted schemas from the catalog section. 
             For example, if you want to process schema-name-01 and schema-name-03 schemas only, then you should change reverse engineering section like this.
         </para>
-        <programlisting language="xml">
-            &lt;configuration&gt;
-                ...
-                &lt;reverseEngineering&gt;
-                
-                    &lt;catalog name="shop_01"&gt;
-                        &lt;schema name="schema-name-01"/&gt;
-                        &lt;schema name="schema-name-03"/&gt;
-                    &lt;/catalog&gt;
-
-                    &lt;catalog name="shop_02"&gt;
-                        &lt;schema name="schema-name-01"/&gt;
-                    &lt;/catalog&gt;
-
-                    &lt;catalog name="shop_03"&gt;
-                        &lt;schema name="schema-name-01"/&gt;
-                        &lt;schema name="schema-name-03"/&gt;
-                    &lt;/catalog&gt;
-                    
-                &lt;/reverseEngineering&gt;
-                ...
-            &lt;/configuration&gt;
-        </programlisting>
+        <programlisting language="xml">&lt;configuration&gt;
+    ...
+    &lt;reverseEngineering&gt;
+
+        &lt;catalog&gt;
+            &lt;name>shop_01&lt;/name&gt;
+            &lt;schema&gt;schema-name-01&lt;/schema&gt;
+            &lt;schema&gt;schema-name-03&lt;/schema&gt;
+        &lt;/catalog&gt;
+
+        &lt;catalog&gt;
+            &lt;name>shop_02&lt;/name&gt;
+            &lt;schema&gt;schema-name-01&lt;/schema&gt;
+        &lt;/catalog&gt;
+
+        &lt;catalog&gt;
+            &lt;name>shop_03&lt;/name&gt;
+            &lt;schema&gt;schema-name-01&lt;/schema&gt;
+            &lt;schema&gt;schema-name-03&lt;/schema&gt;
+        &lt;/catalog&gt;
+
+    &lt;/reverseEngineering&gt;
+    ...
+&lt;/configuration&gt;</programlisting>
     </section>
     <section xml:id="including-excluding-tables-columns-procedures">
         <title>Including and Excluding tables, columns and procedures</title>
         <para>
-            <itemizedlist>
+            Cayenne reverse engineering let you fine tune table, columns and stored procedures names that you need to import
+            to your model file. In every filter you can use regexp syntax. Here is some examples of configuration
+            for common tasks.
+        </para>
+        <para>
+            <orderedlist numeration="arabic">
                 <listitem>
-                    <para>1. Include tables with \u2018CRM_\u2019 prefix if you are working in that domain of application:</para>
+                    <para>Include tables with \u2018CRM_\u2019 prefix if you are working in that domain of application:</para>
                     <programlisting language="xml">
-                &lt;includeTable&gt;CRM_.*&lt;/includeTable&gt;
-                    </programlisting>
+    &lt;includeTable&gt;CRM_.*&lt;/includeTable&gt;</programlisting>
                 </listitem>
                 <listitem>
-                    <para>2. Include tables with \u2018_LOOKUP\u2019 suffix</para>
+                    <para>Include tables with \u2018_LOOKUP\u2019 suffix</para>
                     <programlisting language="xml">
-                &lt;includeTable&gt;
-                    &lt;pattern&gt;.*_LOOKUP&lt;/pattern&gt;
-                &lt;/includeTable&gt;
-                    </programlisting>
+    &lt;includeTable&gt;
+        &lt;pattern&gt;.*_LOOKUP&lt;/pattern&gt;
+    &lt;/includeTable&gt;</programlisting>
                 </listitem>
                 <listitem>
-                    <para>3. Exclude tables with \u2018CRM_\u2019 prefix if you are not working only in that domain of application:</para>
+                    <para>Exclude tables with \u2018CRM_\u2019 prefix if you are not working only in that domain of application:</para>
                     <programlisting language="xml">
-                &lt;excludeTable&gt;CRM_.*&lt;/excludeTable&gt;
-                    </programlisting>
+    &lt;excludeTable&gt;CRM_.*&lt;/excludeTable&gt;</programlisting>
                 </listitem>
                 <listitem>
-                    <para>4. Include only specific columns that follows specific naming convention:</para>
+                    <para>Include only specific columns that follows specific naming convention:</para>
                     <programlisting language="xml">
-                &lt;includeColumn&gt;includeColumn01&lt;/includeColumn&gt;
-                &lt;includeColumn pattern="includeColumn03"/&gt;
-                    </programlisting>
+    &lt;includeColumn&gt;includeColumn01&lt;/includeColumn&gt;
+    &lt;includeColumn&gt;includeColumn03&lt;/includeColumn></programlisting>
                 </listitem>
                 <listitem>
-                    <para>5. Exclude system or obsolete columns:</para>
+                    <para>Exclude system or obsolete columns:</para>
                     <programlisting language="xml">
-                &lt;excludeColumn&gt;excludeColumn01&lt;/excludeColumn&gt;
-                &lt;excludeColumn pattern="excludeColumn03"/&gt;
-                    </programlisting>
+    &lt;excludeColumn&gt;excludeColumn01&lt;/excludeColumn&gt;
+    &lt;excludeColumn&gt;excludeColumn03&lt;/excludeColumn></programlisting>
                 </listitem>
                 <listitem>
-                    <para>6. Include/Exclude columns for particular table or group of tables:</para>
+                    <para>Include/Exclude columns for particular table or group of tables:</para>
                     <programlisting language="xml">
-                &lt;includeTable pattern="table pattern"&gt;
-                    &lt;includeColumn pattern="includeColumn01"/&gt;
-                    &lt;excludeColumn pattern="excludeColumn01"/&gt;
-                &lt;/includeTable&gt;
-                    </programlisting>
+    &lt;includeTable&gt;
+        &lt;pattern>table pattern&lt;/pattern>
+        &lt;includeColumn&gt;includeColumn01&lt;/includeColumn>
+        &lt;excludeColumn&gt;excludeColumn01&lt;/excludeColumn>
+    &lt;/includeTable&gt;</programlisting>
                 </listitem>
                 <listitem>
-                    <para>7. Include stored procedures:</para>
+                    <para>Include stored procedures:</para>
                     <programlisting language="xml">
-                &lt;includeProcedure&gt;includeProcedure01&lt;/includeProcedure&gt;
-                &lt;includeProcedure pattern="includeProcedure03"/&gt;
-                    </programlisting>
+    &lt;includeProcedure&gt;includeProcedure01&lt;/includeProcedure&gt;
+    &lt;includeProcedure&gt;
+        &lt;pattern>includeProcedure03&lt;/pattern>
+    &lt;/includeProcedure></programlisting>
                 </listitem>
                 <listitem>
-                    <para>8. Exclude stored procedures by pattern:</para>
+                    <para>Exclude stored procedures by pattern:</para>
                     <programlisting language="xml">
-                &lt;excludeProcedure&gt;excludeProcedure01&lt;/excludeProcedure&gt;
-                &lt;excludeProcedure pattern="excludeProcedure03"/&gt;
-                    </programlisting>
+    &lt;excludeProcedure&gt;excludeProcedure01&lt;/excludeProcedure&gt;
+    &lt;excludeProcedure&gt;
+        &lt;pattern>excludeProcedure03&lt;/pattern>
+    &lt;/excludeProcedure&gt;</programlisting>
                 </listitem>
-            </itemizedlist>
+            </orderedlist>
         </para>
         <para>
-            All filtering tags includeTable, excludeTable, includeColumn, excludeColumn, includeProcedure and excludeProcedure have three ways 
+            All filtering tags <code>&lt;includeTable&gt;</code>, <code>&lt;excludeTable&gt;</code>, <code>&lt;includeColumn&gt;</code>, <code>&lt;excludeColumn&gt;</code>,
+            <code>&lt;includeProcedure&gt;</code> and <code>&lt;excludeProcedure&gt;</code> have three ways
             to pass filtering RegExp.
-            <itemizedlist>
+            <orderedlist numeration="arabic">
                 <listitem>
                     <para>text inside tag</para>
                     <programlisting language="xml">
-                &lt;includeTable&gt;CRM_.*&lt;/includeTable&gt;
-                    </programlisting>
+    &lt;includeTable&gt;CRM_.*&lt;/includeTable&gt;</programlisting>
                 </listitem>
                 <listitem>
-                    <para>pattern attribute</para>
+                    <para>pattern inner tag</para>
                     <programlisting language="xml">
-                &lt;excludeProcedure pattern="excludeProcedure03"/&gt;
-                    </programlisting>
+    &lt;includeTable&gt;
+        &lt;pattern&gt;.*_LOOKUP&lt;/pattern&gt;
+    &lt;/includeTable&gt;</programlisting>
                 </listitem>
                 <listitem>
-                    <para>pattern inner tag</para>
+                    <para>pattern attribute (only for Ant task)</para>
                     <programlisting language="xml">
-                &lt;includeTable&gt;
-                    &lt;pattern&gt;.*_LOOKUP&lt;/pattern&gt;
-                &lt;/includeTable&gt;
-                    </programlisting>
+    &lt;excludeProcedure pattern="excludeProcedure03"/&gt;</programlisting>
                 </listitem>
-            </itemizedlist>
+            </orderedlist>
         </para>
         <para>
-            All filtering tags can be placed inside schema and catalog tags, but also inside &lt;reverseEngineering&gt; tag. It means that filtering rules
+            All filtering tags can be placed inside schema and catalog tags, but also inside <code>&lt;reverseEngineering&gt;</code> tag. It means that filtering rules
             will be applied for all schemas and catalogs.
         </para>
     </section>
@@ -233,22 +235,21 @@
             Initially, let\u2019s make a small sample. Consider the following reverse engineering configuration.
         </para>
         <programlisting language="xml">
-                &lt;reverseEngineering&gt;
-                    &lt;catalog&gt;shop-01&lt;/catalog&gt;
-                &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+        &lt;catalog&gt;shop-01&lt;/catalog&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
         <para>
             In this case reverse engineering will not filter anything from the shop-01 catalog. If you really want to filter database columns, tables, 
             stored procedures and relationships, you could do it in the following way.
         </para>
         <programlisting language="xml">
-                &lt;reverseEngineering&gt;
-                    &lt;catalog&gt;shop-01&lt;/catalog&gt;
-                    &lt;catalog name="shop-02"&gt;
-                        &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
-                    &lt;/catalog&gt;
-                &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+        &lt;catalog&gt;shop-01&lt;/catalog&gt;
+        &lt;catalog&gt;
+            &lt;name&gt;shop-02&lt;/name&gt;
+            &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
+        &lt;/catalog&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
         <para>
             Then Cayenne will do reverse engineering for both shop-01 and shop-02 catalogs. First catalog will not be processed for filtering,
             but the second catalog will be processed with \u201cincludeTable-01\u201d filter. 
@@ -260,69 +261,60 @@
             Let\u2019s see how to use patterns in reverse engineering configuration with complete example.
         </para>
         <programlisting language="xml">
-                &lt;reverseEngineering&gt;
-
-                    &lt;catalog&gt;shop-01&lt;/catalog&gt;
-
-                    &lt;catalog&gt;
-                        &lt;name&gt;shop-02&lt;/name&gt;
-                    &lt;/catalog&gt;
-
-                    &lt;catalog name="shop-03"&gt;
-                        &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
-
-                        &lt;includeTable&gt;
-                            &lt;pattern&gt;includeTable-02&lt;/pattern&gt;
-                        &lt;/includeTable&gt;
-
-                        &lt;includeTable pattern="includeTable-03"&gt;
-                            &lt;includeColumn pattern="includeColumn-01"/&gt;
-                            &lt;excludeColumn pattern="excludeColumn-01"/&gt;
-                        &lt;/includeTable&gt;
-
-                        &lt;excludeTable&gt;excludeTable-01&lt;/excludeTable&gt;
-
-                        &lt;excludeTable&gt;
-                            &lt;pattern&gt;excludeTable-02&lt;/pattern&gt;
-                        &lt;/excludeTable&gt;
-
-                        &lt;excludeTable pattern="excludeTable-03"/&gt;
-                        
-                        &lt;includeColumn&gt;includeColumn-01&lt;/includeColumn&gt;
-                        
-                        &lt;includeColumn&gt;
-                            &lt;pattern&gt;includeColumn-02&lt;/pattern&gt;
-                        &lt;/includeColumn&gt;
-                        
-                        &lt;includeColumn pattern="includeColumn-03"/&gt;
-
-                        &lt;excludeColumn&gt;excludeColumn-01&lt;/excludeColumn&gt;
-                        
-                        &lt;excludeColumn&gt;
-                            &lt;pattern&gt;excludeColumn-02&lt;/pattern&gt;
-                        &lt;/excludeColumn&gt;
-                        
-                        &lt;excludeColumn pattern="excludeColumn-03"/&gt;
-                        
-                        &lt;includeProcedure&gt;includeProcedure-01&lt;/includeProcedure&gt;
-                        
-                        &lt;includeProcedure&gt;
-                            &lt;pattern&gt;includeProcedure-02&lt;/pattern&gt;
-                        &lt;/includeProcedure&gt;
-                        
-                        &lt;includeProcedure pattern="includeProcedure-03"/&gt;
-
-                        &lt;excludeProcedure&gt;excludeProcedure-01&lt;/excludeProcedure&gt;
-                        
-                        &lt;excludeProcedure&gt;
-                            &lt;pattern&gt;excludeProcedure-02&lt;/pattern&gt;
-                        &lt;/excludeProcedure&gt;
-                        
-                        &lt;excludeProcedure pattern="excludeProcedure-03"/&gt;
-
-                    &lt;/catalog&gt;
-                &lt;/reverseEngineering&gt;
-        </programlisting>
+    &lt;reverseEngineering&gt;
+
+        &lt;catalog&gt;shop-01&lt;/catalog&gt;
+
+        &lt;catalog&gt;
+            &lt;name&gt;shop-02&lt;/name&gt;
+        &lt;/catalog&gt;
+
+        &lt;catalog&gt;
+            &lt;name&gt;shop-03&lt;/name&gt;
+            &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
+
+            &lt;includeTable&gt;
+                &lt;pattern&gt;includeTable-02&lt;/pattern&gt;
+            &lt;/includeTable&gt;
+
+            &lt;includeTable&gt;
+                &lt;pattern&gt;includeTable-03&lt;/pattern&gt;
+                &lt;includeColumn&gt;includeColumn-01&lt;/includeColumn>
+                &lt;excludeColumn&gt;excludeColumn-01&lt;/excludeColumn>
+            &lt;/includeTable&gt;
+
+            &lt;excludeTable&gt;excludeTable-01&lt;/excludeTable&gt;
+
+            &lt;excludeTable&gt;
+                &lt;pattern&gt;excludeTable-02&lt;/pattern&gt;
+            &lt;/excludeTable&gt;
+
+            &lt;includeColumn&gt;includeColumn-01&lt;/includeColumn&gt;
+
+            &lt;includeColumn&gt;
+                &lt;pattern&gt;includeColumn-02&lt;/pattern&gt;
+            &lt;/includeColumn&gt;
+
+            &lt;excludeColumn&gt;excludeColumn-01&lt;/excludeColumn&gt;
+
+            &lt;excludeColumn&gt;
+                &lt;pattern&gt;excludeColumn-02&lt;/pattern&gt;
+            &lt;/excludeColumn&gt;
+
+            &lt;includeProcedure&gt;includeProcedure-01&lt;/includeProcedure&gt;
+
+            &lt;includeProcedure&gt;
+                &lt;pattern&gt;includeProcedure-02&lt;/pattern&gt;
+            &lt;/includeProcedure&gt;
+
+            &lt;excludeProcedure&gt;excludeProcedure-01&lt;/excludeProcedure&gt;
+
+            &lt;excludeProcedure&gt;
+                &lt;pattern&gt;excludeProcedure-02&lt;/pattern&gt;
+            &lt;/excludeProcedure&gt;
+
+        &lt;/catalog&gt;
+    &lt;/reverseEngineering&gt;</programlisting>
         <para>
             The example above should provide you more idea about how to use filtering and patterns in Cayenne reverse engineering.
             You could notice that this example demonstrates you the "name" and "pattern" configurations. Yes, you could use these as separates xml element
@@ -333,4 +325,47 @@
             and table columns. As \u201cshop-03\u201d has variety filter tags, entities from this catalog will be filtered by cdbimport.
         </para>
     </section>
+    <section>
+        <title>Ant configuration example</title>
+        <para>
+            Here is config sample for <code>Ant</code> task:
+            <programlisting language="xml">
+&lt;!-- inside &lt;cdbimport> tag -->
+    &lt;catalog&gt;shop-01&lt;/catalog&gt;
+
+    &lt;catalog name="shop-02"/&gt;
+
+    &lt;catalog name="shop-03"&gt;
+
+        &lt;includeTable&gt;includeTable-01&lt;/includeTable&gt;
+        &lt;includeTable pattern="includeTable-02"/&gt;
+
+        &lt;includeTable pattern="includeTable-03"&gt;
+            &lt;includeColumn&gt;includeColumn-01&lt;/includeColumn>
+            &lt;excludeColumn&gt;excludeColumn-01&lt;/excludeColumn>
+        &lt;/includeTable&gt;
+
+        &lt;excludeTable&gt;excludeTable-01&lt;/excludeTable&gt;
+        &lt;excludeTable pattern="excludeTable-02"/&gt;
+
+        &lt;includeColumn&gt;includeColumn-01&lt;/includeColumn&gt;
+        &lt;includeColumn pattern="includeColumn-02"/&gt;
+
+        &lt;excludeColumn&gt;excludeColumn-01&lt;/excludeColumn&gt;
+        &lt;excludeColumn pattern="excludeColumn-02"/&gt;
+
+        &lt;includeProcedure&gt;includeProcedure-01&lt;/includeProcedure&gt;
+        &lt;includeProcedure pattern="includeProcedure-02"/&gt;
+
+        &lt;excludeProcedure&gt;excludeProcedure-01&lt;/excludeProcedure&gt;
+        &lt;excludeProcedure pattern="excludeProcedure-02"/&gt;
+
+    &lt;/catalog&gt;</programlisting>
+        </para>
+        <note>
+            <para>
+                In Ant task configuration all filter tags located inside root tag <code>&lt;cdbimport></code> as there is no <code>&lt;reverseEngineering></code> tag.
+            </para>
+        </note>
+    </section>
 </chapter>

http://git-wip-us.apache.org/repos/asf/cayenne/blob/34be65a0/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
----------------------------------------------------------------------
diff --git a/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml b/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
index 3125a7b..ca2a7fa 100644
--- a/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
+++ b/docs/docbook/cayenne-guide/src/docbkx/re-introduction.xml
@@ -23,25 +23,87 @@
     		CDBImport is a Maven/Ant plugin that helps you to do reverse engineering. In other words it helps you to synchronize
     		database structure with your Cayenne mapping config. It does not update Java classes by itself, but it synchronizes db
     		and data access layer representation in Cayenne mapping file with actual database state.
-    		Most common practice to complete reverse engineering is to use CDBImport followed by CGen Maven plugin,
+    		Most common practice to complete reverse engineering is to use CDBImport followed by <link linkend="mvn-cgen">CGen Maven plugin</link>,
     		which does class generation according to the Cayenne mapping file updates.
     	</para>
+		<para>
+			Here is simple maven configuration to start with:
+			<programlisting language="xml">
+	&lt;plugin&gt;
+		&lt;groupId&gt;org.apache.cayenne.plugins&lt;/groupId&gt;
+		&lt;artifactId&gt;maven-cayenne-plugin&lt;/artifactId&gt;
+		&lt;version&gt;<?eval ${project.version}?>&lt;/version&gt;
+
+		&lt;configuration&gt;
+			&lt;map&gt;${project.basedir}/src/main/resources/datamap.map.xml&lt;/map&gt;
+			&lt;url&gt;&lt;!-- jdbc url --&gt;&lt;/url&gt;
+			&lt;driver&gt;&lt;!-- jdbc driver class --&gt;&lt;/driver&gt;
+			&lt;username&gt;username&lt;/username&gt;
+			&lt;password&gt;password&lt;/password&gt;
+			&lt;defaultPackage&gt;com.example.package&lt;/defaultPackage&gt;
+		&lt;/configuration&gt;
+
+		&lt;executions&gt;
+			&lt;execution&gt;
+				&lt;goals&gt;
+					&lt;goal&gt;cdbimport&lt;/goal&gt;
+					&lt;goal&gt;cgen&lt;/goal&gt;
+				&lt;/goals&gt;
+			&lt;/execution&gt;
+		&lt;/executions&gt;
+
+		&lt;dependencies&gt;
+			&lt;!-- jdbc driver dependency --&gt;
+		&lt;/dependencies&gt;
+	&lt;/plugin&gt;
+			</programlisting>
+			For full list of <code>cdbimport</code> parameters see chapter <link linkend="mvn-cdbimport">Including Cayenne in a Project</link>
+		</para>
     </section>
 	<section xml:id="re-configuration-file">
-		<title>Reverse Engineering configuration file</title>
+		<title>Reverse Engineering configuration</title>
+		<para>
+			Cayenne is designed to support database reverse engineering automation process via Maven and Ant build tools.
+		</para>
+
 		<para>
-			Cayenne is designed to support database reverse engineering automation process via Maven and Ant build tools. 
-			You could control and configure this process in the several ways:
+			Here is a default template of reverse engineering settings, which should help you to get started:
+			<programlisting language="xml">
+	&lt;plugin&gt;
+		...
+		&lt;configuration&gt;
+			...
+			&lt;reverseEngineering&gt;
+				&lt;skipRelationshipsLoading&gt;false&lt;/skipRelationshipsLoading&gt;
+				&lt;skipPrimaryKeyLoading&gt;false&lt;/skipPrimaryKeyLoading&gt;
+
+				&lt;catalog&gt;
+					&lt;schema&gt;
+						&lt;includeTable&gt;
+						&lt;/includeTable&gt;
+					&lt;/schema&gt;
+				&lt;/catalog&gt;
+				&lt;includeProcedure&gt;.*&lt;/includeProcedure&gt;
+			&lt;/reverseEngineering&gt;
+		&lt;/configuration&gt;
+		...
+	&lt;/plugin&gt;
+			</programlisting>
+			<caution><para>The whole database structure will be loaded after execution reverse engineering with this stub.</para></caution>
 		</para>
-		<itemizedlist>
+
+		<!--itemizedlist>
 			<listitem>
-				<para>Inside ANT/Maven build file</para>
 			</listitem>
 			<listitem>
-				<para>Externally in reverseEngineering.xml file, which will be used by Maven/Ant to perform cdbimport</para>
+				<para>
+					Externally in reverseEngineering.xml file, which will be used by Maven/Ant to perform cdbimport
+					<note><para>Configuration via file is not supported right now</para></note>
+				</para>
+
 			</listitem>
-		</itemizedlist>
-		<para>
+		</itemizedlist-->
+		<!--para>
 			Maven and Ant build files usually contain lots of configuration according to your project requirements. This is why reverseEngineering.xml
 			is designed as a sum of configuration styles of Maven and Ant. It will be quite easy to use and move your configuration from build file
 			definition into separate one. At practice you should be able to cut reverseEngineering section from Maven configuration and paste it into the 
@@ -58,26 +120,24 @@
 			Here is a default template of reverse engineering file, which should help you to get started:
 		</para>
 		<programlisting language="xml">
-			&lt;?xml version="1.0" encoding="utf-8"?&gt;
-			&lt;reverseEngineering
-       				xmlns="http://cayenne.apache.org/schema/8/reverseEngineering"
-       				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       				xsi:schemaLocation="http://cayenne.apache.org/schema/8/reverseEngineering http://cayenne.apache.org/schema/8/reverseEngineering.xsd"&gt;
+	&lt;?xml version="1.0" encoding="utf-8"?&gt;
+	&lt;reverseEngineering
+			xmlns="http://cayenne.apache.org/schema/8/reverseEngineering"
+			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+			xsi:schemaLocation="http://cayenne.apache.org/schema/8/reverseEngineering http://cayenne.apache.org/schema/8/reverseEngineering.xsd"&gt;
 
-    			&lt;skipRelationshipsLoading&gt;false&lt;/skipRelationshipsLoading&gt;
-    			&lt;skipPrimaryKeyLoading&gt;false&lt;/skipPrimaryKeyLoading&gt;
+		&lt;skipRelationshipsLoading&gt;false&lt;/skipRelationshipsLoading&gt;
+		&lt;skipPrimaryKeyLoading&gt;false&lt;/skipPrimaryKeyLoading&gt;
 
-    			&lt;catalog&gt;
-        			&lt;schema&gt;
-            			&lt;includeTable&gt;
-            			&lt;/includeTable&gt;
-        			&lt;/schema&gt;
-    			&lt;/catalog&gt;
-    			&lt;includeProcedure pattern=".*"/&gt;
-			&lt;/reverseEngineering&gt;
-		</programlisting>
-		<para>
-			Note that the whole database structure will be loaded after execution reverse engineering with this stub.
-		</para>
+		&lt;catalog&gt;
+			&lt;schema&gt;
+				&lt;includeTable&gt;
+				&lt;/includeTable&gt;
+			&lt;/schema&gt;
+		&lt;/catalog&gt;
+		&lt;includeProcedure pattern=".*"/&gt;
+	&lt;/reverseEngineering&gt;
+		</programlisting-->
+		<para>In the next chapter we will see more configuration details</para>
 	</section>
 </chapter>