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: how to map
PostPosted: Fri Aug 19, 2005 4:30 am 
Beginner
Beginner

Joined: Wed Aug 10, 2005 4:22 am
Posts: 24
I have two classes namely User and Role. There is many-to-many relation
between them.
class User
{
String name;
String surname;
Set roles;
}

class Role
{
String name;
}

I want to keep this relation, between User and Role, in a different
table.

user
id name surname
1 xxx yyy
2 zzz www

role
id name
1 aaa
2 bbb
3 ccc

user-role
id user_id role_id
1 1 2
2 1 3
3 2 1
4 2 2
5 2 3

How am i going to desing the mapping documents between this 2, so I can have the above 3 tables.
Thanx in advance...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 9:59 am 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
http://www.hibernate.org/hib_docs/v3/reference/en/html/associations.html#assoc-bidirectional-join-m2m


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.