hello, I am a newbie here and would like your opinion on how i can fix this issue i am facing...
I have 3 tables (tabel1, table2, table3) mapped to 3 classes (class1, class2 and class3) using annotations, with the following relationships, say.
Class1 - Class2 (m:n) Class2 - Class3 (1:m) Class1 - Class3 (1:m)
I am trying to write a HQL that will load all objects from Class2 and Class3 that belong to a Class1 with the following HQL:
select c2 from Class1 as c1 join c1.class2s as c2 left join c2.class3s as c3 where c3.class1.id=c1.id
The problem here is the result only returns Class2 objects IF they have a Class3 object associated with them (the left join should return ALL Class2 objects irrespective of whether there are Class3 objects associated with them or not...shouldnt it?), the left join does not seem to have any effect on the query!
eg: if a Class1 object has an associated Class2 object, but no associated Class3 object, it should still come up in the result, but it is not doing so.
|