Hi,
Chris Cook schrieb:
>
> Does anyone have experience with actually creating database schemas from an
> xml file with Castor? For example if I had an oracle schema, I would like
> to use the same xml file I created that schema off of to create it in
> SQL2000.
>
I don't know of any tool to do this - but ...
> Would this be easy to do with Castor?
>
should be not really difficult to do it.
I have written a simple Java source generator for JDO persistance
very quickly and that should be possible for SQL generation also.
Here is a start point:
MappingRoot mapping;
{ // use castor internal parser, structures
log.info( "start reading "+sMapping );
Reader reader = new FileReader( sMapping );
mapping = MappingRoot.unmarshal( reader );
}
Enumeration e = mapping.enumerateClassMapping();
ClassMapping cmap;
while ( e.hasMoreElements() ) {
cmap = (ClassMapping)e.nextElement();
.....
you can use the castor mapping loader and can iterate on it's
declared classes to generate DDL. M-N Relations are somewhat more
difficult (store/remember them as you pass them and generate at end).
A plugin architecture for the target DB (like JDO engines) would be
nice but that would be a real castor sub project ...
HTH,
markus
--
Dipl.-Ing. (FH) Markus Fritz [EMAIL PROTECTED]
Just Innovative Software GmbH * Heimsheimerstr. 1 * 70499 Stuttgart
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev