Hibernate version:3.1
Code:
<class name="School">
<many-to-one name="person" class="Person" column="person_id"/>
<subclass name="Room">
<many-to-one name="person" class="Teacher" column="person_id" insert="false" update="false"/>
</subclass>
</class>
As you can see, I'm overriding the "person" property in the subclass. Everything is the same on the property element, exept the many-to-one class is different than the one in its superclass.
Room is a subclass of School.
Teacher is a subclass of Person.
My first question is, in general, is it ok do this or is it considered evil?
Secondly, the problem I'm having is with the metadata. When I try to programmaticaly get the type of the "person" property on Room from PersistentClass.getProperty("person").getReturnedClass() , it tells me that it is of type "Person" rather than "Teacher" (it's returning the one from the superclass). Is there a way to get it to return "Teacher"?
Thank you