-->
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: Converting a persisted instance into a subclass
PostPosted: Tue Feb 07, 2006 1:44 pm 
Newbie

Joined: Tue Feb 07, 2006 1:33 pm
Posts: 5
Hibernate version:
3.0.3

I'm using a table-per-class mapping strategy with some joined-subclasses, and I'd like to be able to convert an object into a subclass. I have an item persisted in my system as a generic type, and it is later converted into something more specific when a user reviews it and decides what it should be.

I've tried a couple things that haven't worked, like making a new subclass instance and copying the existing data in (including the id), but that didn't work, unsurprisingly. My only real idea at this point is to manually add a new entry to the subclass table and re-fetch, but that seems like a brittle solution.

I've searched these forums and found several other questions like this, but they were either unanswered or inapplicable. I can't be the only one trying to do this, so I'd appreciate any help.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 13, 2006 9:31 am 
Newbie

Joined: Tue Feb 07, 2006 1:33 pm
Posts: 5
Is this just not possible with Hibernate? Judging from the lack of replies, maybe that's the case. If so, this could be a good feature to add.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 09, 2006 8:22 pm 
Beginner
Beginner

Joined: Mon Apr 24, 2006 9:47 pm
Posts: 33
Location: Kansas City, MO
I'm working on this problem as well. If you insert the superclass's ID into the subclass table manually, a call to session.get(Subclass.class, ID) will return your Subclass instance. However, I am looking for a more hibernate specific way of accomplishing this, since I haven't found a way to get the JDBC Connection from the Hibernate Session to perform the manual insert yet.


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.