Hibernate version:3.1.3
I have a one-to-many association between GROUP and QUESTION
This works fine when I need to get all QUESTION entries for a GROUP. The resulting query when a left join is used (simplified):
select
g.*, q.*
from
GROUP g
left outer join QUESTION q
on g.ID = q.GROUP_ID
I want to be able to add a filter / parameter that would result in the following query:
select
g.*, q.*
from
GROUP g
left outer join QUESTION q
on g.ID = q.GROUP_ID and q.ACTIVE = 'Y'
I have tried using a filter but that only adds to the where clause. That does not give me the results I need because I still want the group to be returned if it has not active questions.
I am trying not to use HQL in the case, I want to use XML mapping if at all possible.
Is it possible to add criteria to the "on" clause of a join at runtime?
|