Note that HQL subqueries can occur only in the select or where clauses.
Vishal Pandya wrote:SQL :
Line 1 is easy to convert in HQL.
Line 3 doesn't need to be converted to HQL.
How can I convert Line 2?
Emanuel Kadziela wrote:Is there any direct relationship between A and B? Is it expressed in Java, not just in DB? As far as I know, HQL likes property based joins, like Entity A has a field "private B b" and the join is select * from A as a left outer join a.b as B ....
John Bengler wrote:You're right, as I wrote in my first reply I'm interessted in a real workaround, too, because I encountered the same problems.
And rewriting the query in a way that does exactly the same is something between hard and impossible.
Even this would not return the desired result:
Vishal Pandya wrote:
Now if I do something like,
then it would consider all the records of B while applying the join but I want only few records to be considered for join means I have to apply filter before join occurs.
and not mention the difference between,