I have a in-table class hierarchy that consists of a Person as the base class and a Doctor as a subclass. When I try moving a Person up the hierarchy tree, the discriminator value does not update. Below is my hbm file for the classes.
Hibernate v2.1.2
<hibernate-mapping>
<class name="Person"
table="PERSON"
discriminator-value="1">
<id name="personId" type="java.lang.Long" column="PERSON_ID">
<generator class="sequence">
<param name="sequence">PERSON_ID_SEQ</param>
</generator>
</id>
<discriminator type="java.lang.Integer"
column="TYPE_OF_CONTACT"/>
...
<subclass
name="Doctor"
discriminator-value="2">
...
</sublcass>
</class>
</hibernate-mapping>
Person p = (Person)session.load(Person.class, personId);
Doctor d = new Doctor();
// copy person properties to the doctor
// remove Person from the cache
session.evict(p);
session.update(d);
I receive no errors at all. The doctor information gets saved, just the discriminator does not change. I'm probably overlooking something stupid. Any help is appreciated.
Mike R.
|