Hi
I have two types of user one is an employee and another is a member stored in two tables employee table and a member table respectively.
Id of the employee is mapped
Code:
<id name="empId" type="int">
<column name="EMP_ID" />
<generator class="identity" />
</id>
Id of the member is mapped
Code:
<id name="memberId" type="int">
<column name="MEMBER_ID" />
<generator class="identity" />
</id>
I have another class Qualification which is mapped to the qualification table. Qualification table contain qualification Id and qualification name.
I want to use a unidirectional many to many relational mapping from member to qualification and employee to qualification.
My mapping is
Code:
<set name="qualifications" table="dms_qualification_map">
<key column="MAPPED_ID" />
<many-to-many column="QUAL_ID" class="com.scientia.dms.commons.vo.Qualification"/>
</set>
I am using the same table that is dms_qualification_map for employee and member.
But there is an employee which has the same id of member. I want to uniquely identify the member Id and the employee Id.
That is when retrieving or updating employee the qualification of that employee wants to be retrieved .Now the qualification of the member whose id is same as that of the employee is also retrieved. My idea is to use a new field “Mapped Type” in dms_qualification_map to identify the member and employee uniquely. But I don’t know how it should be mapped.
Please help me.
Thanks in advance.
Scientia