As far as i can see, HQL works with mapped associations. I want to be able to set criteria on a subclass for an association (where only the superclass is mapped to the class i want to return)
Say I have the following structure :
ClassA
PropertyA
ClassA2 (Inherited from ClassA)
PropertyB
ClassA3(Also inherited from ClassA)
PropertyC
ClassB (has a mapped association to class A)
I want to do something like this :
select ClassB classB from classB where classB.ClassA2.PropertyB = ' '
Notice i only want to fetch ClassA2 objects with the PropertyB criteria.
but how can i specify criteria for the subclass? The class 'ClassA2' is not mapped to ClassB, only ClassA is so only set criteria using 'PropertyA'
If i do this :
'select ClassA from ClassA classA where ClassA.PropertyA = 'something', it will return the correct subclass (either ClassA, A2, or A3)'
it returns me classA, what i want is Class B
Any Ideas? Ive had a look around and cannot seem to find any similar problems.
|