`cdbgen` is an Maven 2 mojo that that uses Cayenne DataMap to drop and/or generate schema objects of a specified database. By default, it is bound to the `pre-integration-test` phase. Please see this guide to integration testing with maven2 for ideas of how tie this in with your existing test infrastructure.

### Parameters (as XML elements)

Attribute | Description | Required
--- | --- | ---
map | DataMap XML file to use as a schema descriptor. | Yes
adapter | Java class name implementing org.apache.cayenne.dba.DbAdapter. While this attribute is optional (a generic JdbcAdapter is used if not set), it is highly recommended to specify correct target adapter. | No (but strongly recommended)
driver | A class of JDBC driver to use for the target database. | Yes
url | JDBC connection URL of a target database. | Yes
username | Database user name. | No
password | Database user password. | No
dropTables | Defines whether cdbgen should drop the tables before attempting to create new ones. Default is "No". | No
dropPK | Defines whether cdbgen should drop Cayenne primary key support objects. Default is "No". | No
createTables | Defines whether cdbgen should create new tables. Default is "Yes". | No
createPK | Defines whether cdbgen should create Cayenne-specific auto PK objects. Default is "Yes". | No
createFK | Defines whether cdbgen should create foreign key copnstraints. Default is "Yes". | No

### Examples

Load the Maven 2 plugin and configure the `cdbgen` mojo:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.cayenne.plugins</groupId>
          	    <artifactId>maven-cayenne-plugin</artifactId>
          	    <executions>
                    <execution>
          		    <id>cdbgen</id>
          		    <configuration>
          			<!-- Configuration items go in here.  See table, above. -->
          		    </configuration>
          		    <goals>
          			<goal>cdbgen</goal>
          		    </goals>
          		</execution>
          	    </executions>
            </plugin>
        </plugins>
    </build>

Here is an example of using `cdbgen` to create DB schema objects on a local HSQLDB database named "bookmarker" from a DataMap located in "main/resources/datamap.map.xml":

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.cayenne.plugins</groupId>
          	    <artifactId>maven-cayenne-plugin</artifactId>
          	    <executions>
                    <execution>
          		    <id>cdbgen</id>
          		    <configuration>
          			<map>${project.build.sourceDirectory}/../resources/datamap.map.xml</map>
                            <adapter>org.apache.cayenne.dba.hsqldb.HSQLDBAdapter</adapter>
                            <driver>org.hsqldb.jdbcDriver</driver>
                            <url>jdbc:hsqldb:hsql://localhost/bookmarker</url>
                            <username>sa</username>
          		    </configuration>
          		    <goals>
          			<goal>cdbgen</goal>
          		    </goals>
          		</execution>
          	    </executions>
            </plugin>
        </plugins>
    </build>