Hibernate version: 3.2.1.GA
Mapping documents: Javax annotations
I have the following inheritance structure:
Class A
Class B extends A
Class C extends B
They are stored in the database using a Table-per-subclass strategy (InheritanceType.JOINED in javax.persistance). The ID is in class A and is a generated value.
I have an instance of class B (and therefore A) persisted to the database with a very specific ID. I am trying to "promote" the class B object to a class C object, keeping all of the values and the same ID.
Pseudo code:
B b = get from Hibernate
C c = new C();
copy all values from b into c including b's ID
persist(c);
When I follow that procedure I get a new row in all three table with a different ID that the one I set in object c and therefore different from the id of b. It is very important that I keep the same ID. I have looked though the documentation and forums and couldn't find a example of this and a solution. Any idea on how this could be done using hibernate would be much appreciated.
Thank you,
Centrion
|