-->
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: Best way to change a subclass into a superclass?
PostPosted: Wed Dec 13, 2006 8:47 am 
Beginner
Beginner

Joined: Fri Nov 24, 2006 10:33 am
Posts: 42
Hi

I've got two tables, one of which is an extension of the other using the joined-subclass mapping.

So I have PpiProduct extends Product

Saving and deleting them is fine, but I was wondering what the best (only?) was of converting one into the other (say the user edits a Product, and sets a flag that means its now a PpiProduct)

I'm getting a bit stuck trying to convert from one to the other. If I try to create the new PpiProduct (to fill in the extra fields in the extension table), I get a Duplicate PK-type exception (because it also tries to create a new entry in the Product table too)

If I try to update it, I get other errors (warnings about the object being transient/unsaved etc).

When I want to change one into the other, am I best deleting the original record, and inserting a completely new one?

Thanks

Richard


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 14, 2006 7:19 am 
Beginner
Beginner

Joined: Fri Nov 24, 2006 10:33 am
Posts: 42
Anybody know the answer to this?

It would really help me out


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.