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.  [ 4 posts ] 
Author Message
 Post subject: Modifying Concrete Type
PostPosted: Wed Aug 15, 2007 11:21 am 
Newbie

Joined: Wed Aug 15, 2007 11:02 am
Posts: 2
Hi

I have an inheritance hierarchy mapped using table per subclass. Occasionally it is necessary to modify an instance so that it is a different class and persist this change.

So for example if we had a super class of Cat, which was subclassed by DomesticCat and FeralCat, mapped to three tables, I would need to be able to change a DomesticCat into a FeralCat, deleting a row from the domestic table and inserting one to the feral table.

Is there any way that this can be done through NHibernate?

Many thanks

Alex


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 16, 2007 1:48 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
Since it is not possible in .NET to simply transform an object from one class to another, it isn't possible in NH either. A better way to describe this would be the Role pattern.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 6:33 am 
Newbie

Joined: Wed Aug 15, 2007 11:02 am
Posts: 2
Yes, the Role pattern would be a much better way to go about things.

Is it possible to implement component inheritence or would my roles have to be entity classes?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 17, 2007 10:01 am 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
No, they do have to be entity classes. I think this is because components are analogous to value-types (structs).


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