-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: hibernate v3 - middlegen - implicit relation problems
PostPosted: Sat Jul 16, 2005 3:15 pm 
Newbie

Joined: Sat Jul 16, 2005 2:57 pm
Posts: 7
Location: Montréal, Canada
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


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 16, 2005 7:32 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This question would have been best asked in the tools forum - in anycase I spotted it.

Middlegen can be used on a non-constrained database but you need to define the relationships using crossref tags for each table. Obviously, your other idea is another option. If you constrain the database it would be better if you could retain it. I suspect that you will have al sorts of data issues otherwise - even if both applications can run the old app will be an issue for the hibernate app as its not guaranting data is clean. Your probally know all of this and are stuck but this would really worry me if I was looking at this work.

Cood luck.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.