yes, i'm working on a new castor module that generates the following files:
-castor mapping.xml file
-castor database.xml file
-create-tables.sql file
just from specifying @castor tags in your .java source file (one difference from the old version is that i've associated the @tags with the attributes instead of the methods).
the other feature that i implemented in a default mapping such that for each attribute in your .java file, you don't need to specify a @castor-sql type="...", as it looks up the default sql type for that attribute and uses it for the generation. for example, for my java.lang.String fields, i have the default mapping set to "CLOB", which torque uses to generate the sql type "TEXT" when creating a table. just some convenience to speed up development.
besides creating the above files, it also connects to the database and creates the tables (by executing the create-tables.sql) file.
the ant task looks like:
<ejbdoclet destdir="${cls.dir}" verbose="true">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
<castor
dbMapping="true"
xmlMapping="true"
dbName="${db.name}"
dbEngine="${db.engine}"
jdbcDriver="${db.jdbcDriver}"
user="${db.user}"
password="${db.password}"
url="${db.url}"
generateTables="true"
/>
</ejbdoclet>
i'm have xdoclet generate a db-shema.xml file that torque understands and then call torque to generate the appropriate create-tables.sql file (since they've already done an excellent job at the sql generation for specific databases - didn't want to reinvent the wheel).
when i've worked on the kinks, i'm going to look into making the module more generic and add a "framework" attribute so that generation and automatic table creation for other or mapping frameworks (i.e. hibernate, ojb, etc.) can be easily "plugged in". i imagine it looking something like:
<ormapping
framework="castor" (or "hiberbate")
dbMapping="true"
xmlMapping="true"
dbName="${db.name}"
dbEngine="${db.engine}"
jdbcDriver="${db.jdbcDriver}"
user="${db.user}"
password="${db.password}"
url="${db.url}"
generateTables="true"
/>
however, hibernate and the others wouldn't need the "xmlMapping" attribute, so i would need to redesign this a little...
on a side note, i tried to get ejb working, but was having problems with inheritance and incorrect ValueObject generation (for which i submitted a bug to JIRA). i may go back to ejb, but will see where this castor/ormapping adventure leads me... :)
At 09:41 02/12/20 +0100, you wrote:
Hi tek1, what are you guys doing with Castor? New persistence module for XDoclet?Cheers... Matthias
------------------------------------------------------- This SF.NET email is sponsored by: The Best Geek Holiday Gifts! Time is running out! Thinkgeek.com has the coolest gifts for your favorite geek. Let your fingers do the typing. Visit Now. T H I N K G E E K . C O M http://www.thinkgeek.com/sf/ _______________________________________________ Xdoclet-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-devel
