I have 2 classes mapped as joined subclass:
@Entity
@Inheritance(strategy=InheritanceType.JOINED)
class A{
@Id
@GeneratedValue
private Long id;
}
@Entity
@PrimaryKeyJoinColumn(name="id")
class B extends A{
}
I have created and saved object A, but now I would like to save the same object as B.
The only things that seem to work are:
1. copying all data to B, delete A and save B. (not very useful because it creates a new id)
2. using native sql to insert id from A into B
Is there a way to do this in a "normal hibernate" style?
|