Reputation: 627
I am getting HibernateQueryException,when i use On clause with Left Outer join.
Can anyone suggest me what is the cause.
Regards,
Raj
Upvotes: 3
Views: 6910
Reputation: 677
You can use the 'with' clause:
from Cat as cat
left join cat.kittens as kitten
with kitten.bodyWeight > 10.0
https://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html
Upvotes: 0
Reputation: 242766
HQL doesn't support ... JOIN ... ON ...
syntax, you can JOIN
only on defined relationships between entities (FROM Foo foo JOIN foo.bars bar
).
If you need JOIN
on arbitrary condition, you can use old-fashioned form FROM A a, B b WHERE a.x = b.y
(though you can't make outer join this way). Otherwise have to use native SQL query.
See also:
Upvotes: 5