I have three tables A B and C. Now i want to execute this sql query in HQL:
select * from A as a
left join
B as b
on
a.id = b.id
left join
C as c
on
b.t
I suppose you've already defined all the needed associations in your configuration. If so, in HQL it would look like this:
from A as a left join a.B as b left join b.C as c
There is no "ON" statement in HQL, hibernate does automatically based on your mappings and defined Associations.
Pay attention to a.B and b.C.
You refer to B and C based on already defined aliases a & c.
Use this query
from A as a
left join fetch a.B as b
left join fetch b.C as c