I am developing an application in Spring and has integrated it with Hibernate.
I have a User table, UserGroup table with following schema
User has employeeId as primary key and also has a set like this
<set name="usergrp" table="user_group" cascade="all">
<key column="employeeId" />
<many-to-many column="id" class="in.netambit.domain.UserGroup" />
And have UserGroup table with grpId and grpName
I have achieved the many to many mapping that a user can have mutiple usergroups and multiple user can have same group.
Here are the tables
And due to this mapping i got a user_group table in database which contains the relationship between the two onjects
Now this user_group has all the entries of user who are supervisors
Now i want to achieve many to many relationship between user and supervisor
i know this can be achieved if i have the supervisor table but i dont have this. All the user who are supervisors are mapped in user_group table. Which is not an object in Hibernate .
i want to have a single table assigned_supervisor with user and supervisor relationship
here richa is the employee id of a general user and he is assigned a supervisor with employee id kuldeep