-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Discriminator not updating
PostPosted: Thu Mar 25, 2004 4:38 pm 
Newbie

Joined: Mon Dec 29, 2003 11:30 am
Posts: 3
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 25, 2004 7:05 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It is not possible to downcast a persisted instance.

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.