-->
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: replacing one persistent subclass instance with another
PostPosted: Sat Feb 07, 2004 8:57 pm 
Regular
Regular

Joined: Fri Aug 29, 2003 12:48 pm
Posts: 63
Hi guys, having some trouble figuring out the best way to handle a situation. I've got a parent Form object which contains a bunch of Field children. Field is an abstract class, there are a number of concrete subclasses, e.g. NumberFormat, DateField, TextField, etc. I'm using the discriminator column style of subclass mapping, and it works quite nicely.

I now need to be able to change the classes of some of the fields without changing their identifiers (there are other objects in the hierarchy which reference them). I need, for example, to turn a TextField into a NumberField. Is it possible to do this in hibernate without resorting to hand-crafted sql? Would it be better to collapse my Field class hierarchy, at least as far as hibernate is concerned?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 08, 2004 4:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is really just a OR-Problem. If you can get your objects to misteriously change types in the middle of their lifetime, Hibernate will persist it. I suggest however you change your design.


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.