Select * from Table A left join Table B on A.id=B.id and A.langCode='IN';
where 'IN' is input from user.
Table A and Table B has Mapping For Id but there is no Mapping with LangCode between the two as table B dosent have an column called langCode to map with , i want to write the following query using hibernate criteria without mapping langcode.
Table: Employee : EMP_ID - primary key , NAME , CONTACT_DETAILS
Table:Employee_Lang: EMP_ID- composite primary key, LANG_CODE- composite primary key, NAME
Actual Query:
Select * from Employee Emp left outer join Employee_Lang EmpLang on Emp.EMP_ID=EmpLang.EMP_ID AND EmpLang.LANG_CODE='IN'
I have mapped only the Emp_Id as primary key from both the tables in hibernate hence hibernate criteria will only apply a join on that And not on LangCode.
Note:-I cant change hibernate mapping and can use only hibernate Criteria , as per the clients requirement, please help me on this one.