-->
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: Mapping many=to-many with non-changing data on 1 side
PostPosted: Fri Jul 02, 2010 9:14 am 
Newbie

Joined: Fri Jul 02, 2010 9:00 am
Posts: 9
Hello :)

What would be the best way to map the following many-to-many situation?

I want to map User (userId, username, password, firstname, lastname, roles)

to

Role (roleId, name)

A role is really just a name and the system contains 4 roles (admin, user, etc). Each User can have one or more roles, and each Role can be assigned to one or more Users. These roles never change, so what I need in the database is a USER table with user data and a ROLE table with just 4 records that never change and an association table between them.

Is there a way to specify the roles in a HBM mapping, kinda like an Enum?


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.