Hi all, does anyone know the proper hql for the following?
Class A has a collection of Class B mapped in a middle table. I want to get all B that aren't in any collection in A, basically all B that don't appear in the middle table.
I can do it be getting all the id's for B that are in the middle table and then selecting all B's who's id's don't appear in the previous select.
However, when I try to get the B's in the middle table using the following:
select distinct b.id from B as b, A as a join a.collectionOfBs as bs
I get all instances of B even if they don't appear in the middle table at all.
What's the hql equivalent of:
join a_b_middletable on b.id=a_b_middletable.b_id
Thanks in advance,
M@
|