Hi,
I have a class (and table) A with a many-to-one relationship to class (and table) B with key b.
Code:
<class name="A" table="A">
...
<many-to-one name="b" class="B"
<column name="b"/>
</many-to-one>
</class>
Now I want to query all B's together with the A's pointing to it, which match a certain condition (c). Because for some B's there might be no A which match (c) I have to use an outer join. In SQL it's very easy:
Code:
select * from B left outer join A
on B.b = A.b
and (c)
Because of the outer join I can't put (c) in a where clause. I this case I wouldn't get the B's without A (at least on DB2)
I have no Idea how to express this query in HQL. In HQL I can only write:
Code:
from A x right outer join x.b
The problem is the additional condition (c). I can't put it in the where cluase and I can't influence the "on" clause. Any Ideas?