-->
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.  [ 7 posts ] 
Author Message
 Post subject: one to many relation with no contraint
PostPosted: Sat Oct 18, 2003 8:19 pm 
Newbie

Joined: Sun Oct 12, 2003 9:53 pm
Posts: 13
Location: Buenos Aires, Argentina
Hi all
I'm using hibernate to access a database which I cannot modify (the structure) this database has one to many relationships, but no constraints for foreign keys .

Can I define a one-to-many relationship in such conditions?

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2003 1:39 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
One of the Key benefits of Hibernate is that you don't need to define the joins as it uses the foreign keys to build it for you. You can use HQL (with the where join) to get the information but that would be the extent of it. Unless the data or application is totally broken I wonder why you cannot have the foreign keys.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2003 10:05 am 
Newbie

Joined: Sun Oct 12, 2003 9:53 pm
Posts: 13
Location: Buenos Aires, Argentina
I really don't know what are the benefits, may be preformance. The database I'm wokring with is the bugzilla database (jagzilla.sf.net for more info).
I explored and searched the web for docs about this and couldn't find any.

At this moment I'm about to drop the idea of using relations for this reason, but beeing able to use them would be great, if it can be done


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2003 11:43 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
I don't really understand your problem at all. Hibernate does not require foreign key constraints to function.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2003 12:52 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Foreign keys are useful for mapping generators. Not Hibernate core.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 19, 2003 1:20 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Guys, foreign key constraints ensure referential integrity in the database. All other uses come second. A database with associated entities and no foreign key constraints is not worth anything. I'd "refactor" the database first.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject: Thank you!
PostPosted: Sun Oct 19, 2003 9:25 pm 
Newbie

Joined: Sun Oct 12, 2003 9:53 pm
Posts: 13
Location: Buenos Aires, Argentina
It was the hibernate does not require foreign keys to work what I needed to know. sorry if this was on the docs and I didn't find it.
Thank you all.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.