Hi all,
I am using Hibernate 3.1 and I am facing a problem mapping object hierarchy to different tables.
I have the class hierarchy:
Code:
abstract class Criterion {}
class StringCriterion extends Criterion {} 
class StatusCriterion extends Criterion {}  
I have an appropriate mapping file:
Code:
<hibernate-mapping package="com.criterion" default-access="field">
   <class name="Criterion" table="CRIT_T" abstract="true" discriminator-value="999">
                
                ....
                
      <discriminator column="ELMNT_TYPE" type="long"/> 
       <subclass name="StatusCriterion" discriminator-value="1" >
         <property name="alarmStatus" column="ELMNT_FIRST_VALUE" 
         type="string"/>
      </subclass>
      <subclass name="StringCriterion" discriminator-value="2" >
         <property name="value" column="ELMNT_FIRST_VALUE" type="string"/>
      </subclass>
   </class>
</hibernate-mapping>
This mapping works great, but when I tried to map these classes to different tables (by adding an 
entity-name attribute to the subclass  and class elements in the hbm file) I failed.
I am quite familiar with the 
entity-name attribute and it is not the first time I am using it, but this time it "combined" with sub classing.
Is there any known bug  on that? Or I am simply wrong?
Thanks in advance.
Guy