Castor Doclet

Castor JDO is an OpenSource object-relational mapping tool developed by Exolab ( One of the most difficult task when using this framework is writing the mapping file between java classes and RDBMS tables.

The purpose of the castor doclet is to generate this mapping file from simple javadoc tags added in the source code. It is similar in function with the Xdoclet castor subtask, but without being dedicated to Entity EJBs. Another advantage of Castor-Doclet is its capacity to generate a DDL file for different databases.

The project was initially developped by Herve Tchepannou and Mauch Thorsten (see ) but it was no longer maintained.

In order to use it in an enterprise project, I had to correct some bugs and add support for Oracle and DB2 RDBMSs.

As many Castor users have expressed the need to generate mapping/DDL file on the castor mailing list, it seems that the best way to share the new doclet version is a publicly accessible development server such as Sourceforge.


The current version is 0.4.2


There is no installation needed, just add the necessary jars to the project's CLASSPATH :

  • castor-doclet.jar
  • jdom.jar
  • xerces.jar

You can then use an ant target to generate both Castor mapping file and DDL file :

<target name="mapping" depends="compile">
	<javadoc packagenames="test.*"
       additionalparam=" -J-DFILE=ddl/create.sql  -J-DDB_TYPE=db2 -J-DLOG=1">
	  <classpath refid="classpath"/>
	<javadoc packagenames="test.*"
       additionalparam="-J-DFILE=properties/mapping.xml -J-DLOG=1">
	  <classpath refid="classpath"/>
  • Improved HypersonicSQL support (
  • Fixed bug 685449 Array Types not handled correctly (Peter den Haan)
  • Added PostgreSQL support (Brian D. Williams
  • updated to castor (MGU)
  • added oracle config file (Sergej Maslyukov)
  • correct type for java.sql.Time with Oracle (MGU)
  • @sql-name is supported in compound fields (MGU)
  • update jdom version to beta 8 (Ruslan Gainutdinov)
  • add version information in jar file (MGU)
  • add compound example (MGU)
  • add many to many example (MGU)
  • Add support for short class names (without package name) with @depends and @field-type tags (MGU)
  • Reorganized examples directory to switch database easily (MGU)
  • Get sql-type from database specific file and support castor short names (MGU)
  • Suppression of deprecated @type tag support (MGU)
  • Added tag reference documentation (MGU)
  • Added one-one relationship and types examples (MGU)
  • Improve index handling to allow both ',' and ' ' separators (MGU)
  • Handle multiple levels of abstract superclasses (MGU)
  • Added default sql types in JDO mapping for char, byte, date, short (MGU)
  • Added HSQLDB support (MGU)
  • Corrected various SQL types definitions in properties files for Oracle and DB2 (MGU)
  • Corrected bug in sql-name generation for one-one relationships in JDO (MGU)

  • Include properties in castor-doclet.jar (MGU)
  • Add sequence generation support (MGU)
  • Add Oracle and DB2 support (MGU)
  • Generate all DROP statements at the beginning of the DDL (MGU)
  • Change foreign key naming convention to FK_ (MGU)
  • Uppercase field sql-name (MGU)
  • Correct a bug in Maker.compoundPrefix (MGU)
  • Change generation order for JDO mapping file (MGU)
  • Add tag name test in JDO.endCompoundField from DDL (MGU)
  • Delete build scripts (build.xml is platform independent) (MGU)
  • Delete doclet scripts (Use ant tasks instead) (MGU)
  • Add web site documents (MGU)
  • New build/packaging process (MGU)
  • Rename packages to org.castor.doclet (MGU)
  • Remove old ant.jar (MGU)


Initial version uploaded on sourceforge.