i do have an inheritance tree of 3 classes: subject, person and organisation. subject is my abstract superclass whereas person and organisation do inherit from subject and are concrete classes.
i have mapped this classes in hibernate 3.1.3 using the table-per-subclass strategy. now i want to fetch all persons and organisations using the criteria query api. i used
Code:
DetachedCriteria.forClass(Subject.class);
this criteria returns to me instances of subject, person and organisation (i made subject non-abstract meanwhile).
my question is: how do i have to conifg hibernate to return me only persons and organisations and to ommit subjects?
here the mapping i use as an example:
Code:
<hibernate-mapping package="com.example">
<class name="Subject" table="subject">
<id name="id" type="integer" column="subject_id">
<generator class="seqhilo">
<param name="sequence">bip_domain</param>
<param name="max_lo">100</param>
</generator>
</id>
<joined-subclass name="Person" table="person">
<key column="subject_id"/>
</joined-subclass>
<joined-subclass name="Organisation" table="organisation">
<key column="subject_id"/>
</joined-subclass>
</class>
</hibernate-mapping>
any suggestions?
thx in advance, Gaetano