I can't find anywhere in the forum a satisfying answer on how to make a query over a collection of the following type with the criteria api:
select distinct g.*
from group as g, member as m1, member as m2
where g.groupId = m1.groupId
and g.groupId = m2.groupId;
in other words, how do I find the 'group' containing 'member1' and 'member2'?
using createCriteria() multiple times on the same entity (2 x member on 1 group) is causing a bad SqlException.
can anyone tell me if this is not supported by the current criteria api? If it is, a simple code snippet would be greatly appreciated.
thanks a lot to the brave soul who will bring me the answer!
|