-->
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.  [ 3 posts ] 
Author Message
 Post subject: Changing Between Subclasses on Update
PostPosted: Wed Nov 17, 2004 12:36 pm 
Regular
Regular

Joined: Wed Nov 17, 2004 11:49 am
Posts: 65
Location: Pittsburgh
Hibernate version:
2.1.4

OK, this is a general question. I haven't been able to find any documentation on how exactly this is supposed to work, and I haven't been able to get it to work to my satisfaction. Let's say I have a DomesticCat and an AlleyCat, both of which map to the CAT table. I also have a Person class. I am wondering what the implementation of the DomesticCat Person.adopt(AlleyCat alleyCat) method would look like.

I was expecting this to be a simple update, but what I am seeing is that the discriminator column is not getting updated and the columns that are specific to AlleyCats are not getting nulled out. The only thing that does seem to work as I would expect is that the columns specific to DomesticCats are getting populated.

So, I was doing something analogous to:

Code:
DomesticCat domesticCat = new DomesticCat(alleyCat); //importantly, copies primary key column
session.saveOrUpdate(domesticCat)


I am wondering if this is supported behavior, first of all, and if it is, perhaps an overview of the mapping file session chemistry that should make it work.

I should mention that deleting the AlleyCat row and inserting a new DomesticCat row works fine, but is less than ideal for my actual scenario.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 1:11 pm 
Regular
Regular

Joined: Wed Nov 17, 2004 11:49 am
Posts: 65
Location: Pittsburgh
I have found that this is not supported behavior. I maintain that it *ought* to be supported.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 09, 2004 1:15 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This has been discussed extensively here already. No need to start another discussion.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.