I was having a problem in getting result through hibernate.
I have four tables SnsUser, Participant, Interaction, Content;
SnsUser & Interaction has many-2-many relationship and Interaction and Content has many-2-one.
(SnsUser and Interation got Set of Participant in there mapping classes, hibernate does for many-2-many)
when I run HQL like
from SnsUser s join fetch s.participants p join fetch p.interaction i join fetch i.content c where s.blessUid=1
(returning List(SnsUser) list)
it gives me let say 10 rows and in each row (i.e. SnsUser) has 10 rows as Participant.
But when i run like a HQL like
from Participant p join fetch p.snsUser s join fetch p.interaction i join fetch i.content c where s.blessUid=1
it gives me 10 rows and i can get the relevant SnsUser from it. BUT when i look at the actual sql query it is same for the both. Why it behaves like this... ?
answers would be appreciated. al