Hi! I am i newbie and i have a problem with this (which honestly seems quite simple, but still...!):
Concerning the reference's example of the Cat and the DomesticCat subclass,
I want to retrieve with one query (for training purposes) all of the Cats (including the Domestic). But i want to have in the results the "name" property of the Domestic Cats as well, of course only for the Domestic Cats.
I have had several problems trying to do that, including having to retrieve the DomesticCats twice, some casting problems and several NullPointerExceptions when trying with joins(which also have to do with casting).
Could you please point out a solution, or a direction towards it.
I know I am just stuck, but it's for good!
For those who dont remember the Cat example:
class Cat{
//data members
//geters and setters
}
class DomestcCat extends Cat{
String name;
getName(),setName
}
The mapping:
<class name="Cat" table="cats" discriminator-value="C">
<discriminator column="subclass" type="character"/>
....
....
<subclass name="DomesticCat" discriminator-value="D">
<property name="name" type="string"/>
</subclass>
</class>
|