rajputhch
rajputhch

Reputation: 627

ON clause with Hibernate Query interface

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

Answers (2)

tibi
tibi

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

axtavt
axtavt

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

Related Questions