Hi all,
I would like to know if this is possible:
I've got the two following classes:
class A
class B extends A
...each one have a mapping against a different table:
A -> TABLE_A
B -> TABLE_B
and some columns are replicated on both tables... legacy DB :-(
I need to "move" an instance of class B to class A (that is, copy the
data from TABLE_B to TABLE_A).
I try this way: i've got an instance of class B (let's say 'b') and make
a call to a method insert(A a) in one of my DAOs passing 'b' as argument. The implementation of insert() just makes a save on the current Session
with this object as argument.
I think (but i must be wrong) that, giving that b is an A, and my insert
method receives it as an "A" object, Hibernate should, when persisting, apply the A mapping (an insert against TABLE_A)... (and then i would
be very happy)... but no way: Hibernate always treats b as a "B" object,
apply the B mapping, and insert against TABLE_B...
Any tips?
PS: Pardon for my English... ;-)
|