How to write HQL for left outer join with criteria? -


i new hibernate, can correct hql below sql find out unique employees working client currently. if possible please provide me links tutorial.

while parsing sql able receive records database & native sql, when use below hql not receive records.

sql :

select distinct u.employeeid employee u      inner join address ad on u.employeeid = ad.employeeid     left join company cp on (ad.oldcompanyid = cp.currentcompanyid , cp.wokingornot='y')     left join client cl on (ad.oldcompanyid = cl.currentcompanyid , cl.wokingornot='y')      (u.lastdate null , ad.lastdate null)            , (cp.wokingornot = 'y' or cl.wokingornot = 'y'); 

please correct hql listed below :

select distinct u employee u ,address uo,company tp ,client mp   inner join u.address uo  left join uo.company tp   tp.wokingornot= true   left join uo.client mp mp.wokingornot= true  (u.lastdate null , uo.lastdate null)  , (tp.wokingornot= true or mp.wokingornot= true ); 

below entities looking hql:

public class employee { public int employeeid ; public set<address> address; public date lastdate; public date startdate; }  public class address{ public int addressid; public int oldcompanyid; public employee employee; public date lastdate; public date startdate; }  public class company{ public int currentcompanyid; public string wokingornot; public address address; }  public class client{ public int currentcompanyid; public string wokingornot; public address address; } 

it's going more this. whole object graph employee class through address down company , client classes.

select distinct u employee u join u.address uo left join uo.company tp left join uo.client mp  u.lastdate null , uo.lastdate null , (tp.wokingornot= true or mp.wokingornot= true ) 

Comments