-->
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.  [ 1 post ] 
Author Message
 Post subject: three-entity table with foreign keys to 2 two-entity tables.
PostPosted: Mon Feb 21, 2005 4:04 pm 
Regular
Regular

Joined: Fri Jan 28, 2005 3:11 am
Posts: 81
I have 3 main tables: USER, GROUP, ROLE
USER and GROUP many-to-many relationship is implemented via GROUP_USER table and GroupUser class.

GROUP and ROLE many-to-many relationship is implemented via GROUP_ROLE table and GroupRole class.

Now, for a given group, a user plays a particular role. So I then have another table called GROUP_USER_ROLE which has two complex foreign keys, one maps the GROUP_ID and USER_ID to those in the GROUP_USER table and the other maps the GROUP_ID and ROLE_ID to those in the GROUP_ROLE table.

How do I model such a relationship in hibernate? Please give an example, if possible.


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

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.