cdbgen is an Ant task that uses Cayenne DataMap to drop and/or generate schema objects of a specified database.
|DataMap XML file to use as a schema descriptor.
|Java class 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)
|A class of JDBC driver to use for the target database.
|JDBC connection URL of a target database.
|Database user name.
|Database user password.
|Defines whether cdbgen should drop the tables before attempting to create new ones. Default is "No".
|Defines whether cdbgen should drop Cayenne primary key support objects. Default is "No".
|Defines whether cdbgen should create new tables. Default is "Yes".
|Defines whether cdbgen should create Cayenne-specific auto PK objects. Default is "Yes".
|Defines whether cdbgen should create foreign key copnstraints. Default is "Yes".
Support for "classpath" or "classpathref" attributes is pending. To work around this limitation, JDBC driver (and custom DbAdapter) classpath can be appended to the classpath used to load the task via "taskdef".
Load the Ant task (note: if you already loaded all Cayenne tasks via an antlib taskdef described before, this step is not needed):
Here is an example of using cdbgen to create DB schema objects on a local HSQLDB.