I am currently trying to build a new Java application on top of an
already existing database which cannot be modified, because an old
application is working with it. The database contains a major
design problems:
Relations are implicit; this means we have quite many relations
between the tables, but these are not defined as FOREIGN KEY. So the
application must "know" what the relations are, it is not possible to
extract this info from the database schema itself.
I want to create an object-relational abstraction layer using hibernate which would implement the relation constraints and things like ON DELETE CASCADE and ON UPDATE CASCADE. Exactly like in your case, I cannot change the database schema to implement the constraints without crashing the legacy application.
What should I do?
Here's what I intend on doing:
- Copy my original database schema into a dummy database
- Modify the dummy database schema to implement the relationship constraints (foreign keys, - on delete, on update)
- Use middlegen on the dummy database schema
- Use the generated java classes on my original database schema
Is it how this should be done? Do you have any comments or suggestions? Do you know any references which could help with this kind of problem?
Thank you,
Best regards,
Simon
_________________ École Polytechnique de Montréal
|