I has three PO: A1,A2,B. there is a inheritance mapping between A1 and A2, A2 extends A1,
and A2 has special property "color". in addition, there is a many-to-one mapping between
B and A1.
I want to write some HQL like:
Code:
from B where B.a1.class=A2 and ((A2)(B.a1)).color='red';
but it's failed(phrase error).
My question is how can i get the objective except using:
1.
Code:
select B from B,A2 where B.a1.id=A2.id and A2.color='red'
2.
Code:
from B where B.a1.id in (select A2.id from A2 where A2.color='red')
3. native SQL
Help will be appreciated! (even tell me that my objective is wrong)
Thanks!
greencar2000