I didn't find this in Castor yet, and I think that is handy to create the script
from the mapping files. It would either be used as a starting point to finetune
by hand, or as something that can be generated when needed, so one doesn't have
to to change both the mapping and the database by hand when the datamodel changes.
I made a first shot at it, using XSL stylesheets. It is very limited;
- it has only been tested with two mappings on postgresql
- it only knows quoting rules and some jdbc type -> database type rules for
- it only works with non-complex identities (otherwise primary key declarations
will be omitted)
- it can only find the sql type of a foreign key column if the java class that
it maps to is defined in the same mapping file, otherwise the type "integer"
- it probably contains many bugs
Still I wanted to share it already, in case I don't continue working on it or
else to see if this is something that people find interesting.