John,
 Thanks for the reply! Comments inline.

-Gus

John wrote:

Gus, I have modified the jakarta-commons-sandbox/sql project (was supposed to move to db.apache.org, but hasn't). Previously it could only create ddl for any database from a torque-style xml, but I added support to do a diff from an existing database and generate ddl to add and remove columns, tables, and indices. With a flag you can have it generate the entire ddl or just the ddl for new stuff, the drops are optional, too.

Cool. This sounds excellent. Exactly what I need. I feel better about not having found it yet too :).

Unfortunately, the project owners never accepted (had time to?) put my patches in, but I can make them available.

Yeah, that would be interesting, please do. Even better if it could actually get added to the project. If you point me to where you submitted it or some such I would be willing to add a vote (if it is in bugzilla) and/or a feature request mail to their list.

This project was supposed to replace the ddl generation part of Torque and let it focus on just the O-R mapping, but I don't think that is going to happen soon. I haven't followed Torque for a while, but neither it nor anything else I looked at could bring a db up-to-date, just create one from scratch, so that's why I did the work.


Well there is no reason it can't provide the capability in the mean time until Torque implements something, or the torque crew switches over to using commons....

I have an xsl that transforms my ojb repository.xml to the database xml, but any other method that exists for generating that should work. You could use the sandbox/sql ant tasks within maven/ant to create/modify your database.

This sounds like the easiest first route....

Or you could do like me and check the schema when initializing OJB so the database is always up to date.


Could you elaborate on this?

John Marshall
Connectria



===== Original Message From Gus Heck <[EMAIL PROTECTED]> =====
Well things seem to be moving along, and I finally have tamed enough of
struts, xdoclet and OJB configuration  and understood enough JDO to
actually get to the point where my web app tries to write to the
database. (YEA!) I was not supprised however to get this exception:

java.sql.SQLException: General error, message from server: "Table

'fdbtest2.LocationBase' doesn't exist"


        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1825)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1020)

I kinda figured that I handn't yet done anything to propogate the tables
into the database. XDoclet is nicely generating my repository_user.xml
file, and I am wondering if there is a way to push the tables into the
database (based on the repository.xml file) at runtime. Ideally, I would
like the following in the end:

From my ant file;
reload (with tomcat ant task) mode.testing = true
-  drop the test database
-  recreate the test database
-  create the tables
-  run the app.

reload (with tomcat ant task) mode.testing = false
-  DO NOT drop the test database
-  add any tables that are missing (new classes to persist) to the
database
-  run the app.

The first scenario basically mirrors the unit test test database setup I
think, but the second seems to require the ability to do a create if
needed, which I suspect won't be easy from ant (unless I write a custom
task, which is somthing I might consider doing). I am hopping that there
is a nice easy way to push tables into the database (using OJB from
java), if they don't exist. (but I havn't found it yet in the docs)
Since It didn't jump out at me I was wondering if this is something
already well know to people on this list. If I can do it via
configuration settings for the OJB back end and not venture beyond the
JDO API in my code that would be nice too, but I expect that that is
probably asking too much.

Seeking suggestions....

Gus




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to