David Soergel wrote:
>
> >I was wondering whether you couldn't use the DatabaseMetaData object to
> >dynamically java objects directly from the database connection, if the
> >driver supports it. One advantage I see is that it might better support
> >handling non-standard types as the driver maps the database specific
> >type to a Java equivalent one, which is what you want in any case. I
> >haven't played with it a whole lot, but it seems like you could check
> >table schemas and keys.
>
> Unfortunately, you can't do ORMapMaker's code generation based only
> on the metadata. It needs to know what you want to call the to-many
> relations, and also what Java types you want to use for different
> columns (which might not match the default... I might want a NUMBER
> column to represent a Boolean). That is, all the stuff that
> ORMapMaker reads out of comments in the schema won't be available in
> metadata.
>
> So, while DatabaseMetaData is nice in principle, I'm not sure exactly
> what you want to use it for here...?
Basically, my (minor) concern is the assumption of using the SQL script
that represents the schema. I'm moderately concerned that 1) some tools
don't easily give this to you (maybe access, mSQL, maybe some Object
database exposing themselves via odbc...), 2) the SQL script will have
different SQL conventions, enough to make your life difficult and need
to continually add support for a new database vendor. (I remember a
year or two ago I was reading the scripts for a Postgres database and
trying to shove that into a MS SQL 7.0 database and it wasn't pretty.)
Again, this is a minor concern, but what about instead of asking the
developer to take their SQL script, making a quick SQL script generator
based on schema info from DatabaseMetaData? The developer can then
markup *that* script, instead of a more wildly varying script, and
hopefully get more compatibility across databases. If I remember from
the SQL logs, you have MySQL and Oracle support, which is most people
that travel these open source circles are going to want, but I just like
code portability (across databases even) whenever possible. ;)
Actually, what would really be nice is if DatabaseMetaData has
facilities to create/alter tables, so you could take a blank database
device, and create the table structure based on the SQL script you
have. Anyway, sorry, I'm just rambling at this point.
Serge
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]