Due to some strange requirements from our Oracle DBAs, I cannot access our databases "live", I must copy the data from Oracle to a local MySQL database (yes, it's very lame but totally out of my control). I have written a utility to do this (not using Hibernate, just straight JDBC as it's "legacy"). The problem that I run into is that I run this via cron, outside of the web app and again not using Hibernate, and when it is done running, the web app cannot access the database for a while (until a cache timeout?).
In order to speed up the copy, and because the original data doesn't have any timestamps or anything (ie. a way to know if it's changed), I just delete the contents of the table, then iterate over the ResultSet from the original and insert into the copy. I'm guessing this is when Hibernate looses things.
I am looking for a way to make the copy happen so that Hibernate will notice the changes and just keep "working". I am guessing I will have to do this within the web app (with Quartz to schedule?).
I'm using the Hibernate Struts PlugIn if it makes any difference. Any pointers on either making a copy or making Hibernate aware of what happens underneath it would be appreciated.
Thanks!
|