License     Codehaus     OpenEJB     OpenJMS     OpenORB     Tyrex     
 

Main
  Home
  About
  Features
  Download
  JavaDoc
  Maven 2 support
  DTD & Schemas
  Recent changes
  News Archive
  RSS news feed

Development/Support
  Mailing Lists
  SVN/JIRA
  Contributing
  Support
  Prof. services

Related projects
  Spring ORM support
  Spring XML factories

XML
  Using XML
  XML Mapping
  XML FAQ
  XML HOW-TOs
  Custom Handlers
  Best practice

XML Code Generator
  Introduction
  Properties
  Custom bindings
  Ant task
  Maven 2 plugin
  Command line
  Schema Support
  Example

JDO
  Introduction
  First steps
  Using JDO
  JDO Config
  Types
  JDO Mapping
  JDO FAQ
  JDO Examples
  JDO HOW-TOs
  Other Features
  JDO sample JAR

Advanced JDO
  Caching
  OQL
  Trans. & Locks
  Design
  KeyGen
  Long Trans.
  Nested Attrs.
  Pooling Examples
  LOBs
  Best practice

DDL Generator
  Using DDL Generator
  Properties
  Ant task
  Type Mapping

More
  Presentations
  The Examples
  3rd Party Tools
  JDO Tests
  XML Tests
  Configuration
  Tips & Tricks
  CastorWiki
 
 

About
  License
  Contributors
  Marketplace
  Status, Todo
  Changelog
  Library
  Contact
  Project Name

  



Using the Ant task for the Castor DDL Generator

Documentation Author(s):
Werner Guttmann


Castor DDL generator Ant task
    Configuration
    Example


Castor DDL generator Ant task

An alternative to using the command line as shown in the previous section, the Castor DDL Generator Ant Task can be used to call the DDL generator for class generation. The only requirement is that the castor-<version>-anttasks.jar must be on the CLASSPATH.

Configuration

Please find below the complete list of parameters that can be set on the Castor source generator.

mappingFile The name of the Castor JDO mapping file to use as input for DDL generation. Yes
ddlFileName The name of the DDL file to be generated. Yes
databaseEngine The name of database engine to generate DDL for. Yes
globalProperties Name of a custom (global) properties file to be used during DDL generation. No
databaseEngineProperties Name of a custom database specific properties file to be used during DDL generation. No

Alternatively to specifying the mappingFile property, it is possible to work with a nested <FileSet> element or with the mappingDir property.

Example

Below is an example of how to use this task from within an Ant target definition named 'castor:ddl:src':

  <target name="castor:ddl:src" depends="init"
             description="Generate a DDL script from a JDO mapping file.">

    <taskdef name="castor-ddlgen"
             classname="org.castor.anttask.CastorDDLGenTask"
             classpathref="castor.class.path" />
    <mkdir dir="generated" />
    <castor-srcgen mappingFile="src/main/resources/mapping.xml"
                   ddlFileName="target/generated/ddl/mapping.sql"
                   databaseEngine="mysql"/>
  </target>
        

 
   
  
   
 


Copyright © 1999-2005 ExoLab Group, Intalio Inc., and Contributors. All rights reserved.
 
Java, EJB, JDBC, JNDI, JTA, Sun, Sun Microsystems are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and in other countries. XML, XML Schema, XSLT and related standards are trademarks or registered trademarks of MIT, INRIA, Keio or others, and a product of the World Wide Web Consortium. All other product names mentioned herein are trademarks of their respective owners.