Hibernate HQL: how to use a complex left join fetch
问题 I want to add a left join on TASK table when the following condition occurs: LEFT JOIN FETCH PROMPT p on (t.id = p.task.id and p.applicationName in ('XXX') ) Here is my hql query: select distinct t from TASK t LEFT JOIN FETCH SERVER ser on t.id=ser.task_id LEFT JOIN FETCH APPLICATION app on ser.id=app.server_id LEFT JOIN FETCH PROMPT p on (t.id = p.task.id and p.applicationName in ('XXX')) where t.id=ser.task.id and ser.id=app.server and app.name in ('XXX') order by t.id I get the following