Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3
Hi
Sorry for the lame n dumb question ..
I'm pretty new to hibernate ..actually starting off.. and have this question of how to do mappings.. I did search the forums but couldnt find exactly what I was looking for..
this is the scenario
A 'User' in the webapp can have multiple 'Role's.. say like admin, reviewer etc.
I have 3 classes
User [ userid, name, pwd , roles,.....]
Role [ roleid, description ]
UserRoles [ userid, roleId]
and three tables
User (id, name, pwd.... ) (pl note that theres no 'roles')
Role (roleId, description )
UserRoles( userid, roleId)
I presume that there must be a one-to-many mapping from User to UserRoles and many-to-one from Roles to User
Is this approach correct .. ? Id like to see how mappings look like
edit
===
Do we need this three class approach ?