-->
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.  [ 1 post ] 
Author Message
 Post subject: Change class of object with discriminator column
PostPosted: Mon Nov 07, 2011 6:51 am 
Newbie

Joined: Mon Nov 07, 2011 5:54 am
Posts: 1
Hi
I have a problem for which I seem to find no answer. In our project we have single-table inheritance with a discriminator column.

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "CATEGORY")
public abstract class A {
...
}

@Entity
public class B extends A {
...
}

@Entity
public class C extends A {
...
}

The problem is that we sometimes need to change objects of type B to objects of type C. Could you suggest how I should do it?
I'd rather not delete and insert a new object because there are other entities referencing the old object.
What would happen if I flushed the entity manager and then used native sql to change the discriminator column? Would it work? Is there another way perhaps?

Thanks in advance and have a good day!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.