Hi,
I have 2 tables Member and Employ both are mapped to a third table Qual_Def through the mapping table Qual_Mapping.
Sample data
Memberm_id ||
m_name 1 || John
2 || Taylor
3 || Martin
Employe_id||
e_name1||Peter
2||Stacey
3||Lisa
Qual_Mapqmap_id||
m_p_id||
q_id||
map_type1||1||10||M
2||1||20||M
3||2||10||M
4||3||30||
EHere q_id is the QaulDef id and map_type is a discriminator which will help to identify its a Member or Employ.
Now I want to retrieve all the Member and their qualifications. Hence I am using HQL and a left outer join from Member to Qual_Map. Here the issue is , this will show me that Martin have a qualification (where he does not have one). This is incorrect because the qaulification 30 is mapped to Lisa, an employ. I can put an additional filter criteria in
SQL like
Code:
select M.* from Member M
left outer join Qual_Map Q on (M.M_ID=Q.M_P_ID and Q.MAP_TYPE='M');
But I don't know how can we make this possible using HQL.
Can anybody suggest ?
Note:I do not wish to use native SQL
Thanks in advance
SHaiju