We currently have the following task ahead, and I'm struggling to find what I believe should be out there somewhere.
A datamodel is stored in MySQL via Hibernate. Everything works fine and the product is shipped.
For a planned future version though changes to the datamodel are required. We do not yet know what changes and how drastically, but we do know that customer databases have to be updated accordingly.
This will most likely happen again on future versions of the future version, which brings me to part one of the question:
- Is it reasonable to solve this problem by converting existing database contents via exporting them to an XML file, based on the Hibernate version they have been created with and then update the contents (f.ex. with XSLT), before rewriting the database contents with the updated Hibernate version?
I can see the following advantages of this approach:
- We have to write one XSLT once for a new version.
- We can easily apply this to all customers - even automated.
- We can easily transform database contents from version X to version Y, even if there are several versions in-between, by chaining the corresponding XSLTs.
The actual problem, however, assuming this approach will be followed, is that we do not want to write additional code for generating the corresponding XML files. Optimally, I'd like to use a database that stores its contents in a XML file and provides a JDBC interface. Does anyone here know of how to achieve this with the minimal effort?
The workflow I have in mind would be the following:
- Use Hibernate datamodel from version X. Create two database connections, one to MySQL DB, one to XML DB. Read out everything from the first, dump it into the later (this requires a little custom code probably)
- Write the XSLT, execute it on the XML DB's XML file.
- Use Hibernate datamodel from version Y. Create two database connections, one to MySQL DB, one to XML DB. Read out everything from XML and dump it back into MySQL.
Feasible? Is there a totally better way to solve the problem? And where can I find a JDBC-supporting XML database?