-->
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: one-to-many associations of foreign keys to existing tables
PostPosted: Sun Nov 06, 2005 9:15 pm 
Newbie

Joined: Fri Nov 04, 2005 1:02 pm
Posts: 1
Location: San Francisco
I am having trouble creating a one-to-many relationship between two existing classes that each have their own DB tables with their own primary keys. If I was not using Hibernate, I would simply creating another, associating table with 2 columns, 'aId' and 'bId' for classes A and B. However, everything I have tried based upon the existing sample files and the Hibernate manual have failed me, with various errors to complicated to explain with any brevity.
I don't just want to work around having an associating table, because I want to associate class A and class B with more than just one such table (class A has multiple one-to-many relationships with objects of type B, so I'd like to create multiple associations, each with its own table).

How can I create a table that does nothing more than associate two foreign keys? I can think of multiple kludge workarounds, but this is the way I would like to do it.

Thanks,
Jason Fisher

P.S. I'm somewhat of a newbie to Hibernate, and I'm jumping midstream into a project that has been using it already. I have lots of experience doing JDBC and SQL (and thus can see the potential time-saving value of Hibernate), but some of Hibernate (and the documentation) are over my head, do to lack of extreme database expertise. So, please, feel free to dumb down your answer :)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Nov 06, 2005 11:50 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
http://www.hibernate.org/hib_docs/v3/re ... l-join-12m

and before, read:

http://www.hibernate.org/hib_docs/v3/re ... child.html


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.