Hibernate version:
2.1.4
OK, this is a general question. I haven't been able to find any documentation on how exactly this is supposed to work, and I haven't been able to get it to work to my satisfaction. Let's say I have a DomesticCat and an AlleyCat, both of which map to the CAT table. I also have a Person class. I am wondering what the implementation of the DomesticCat Person.adopt(AlleyCat alleyCat) method would look like.
I was expecting this to be a simple update, but what I am seeing is that the discriminator column is not getting updated and the columns that are specific to AlleyCats are not getting nulled out. The only thing that does seem to work as I would expect is that the columns specific to DomesticCats are getting populated.
So, I was doing something analogous to:
Code:
DomesticCat domesticCat = new DomesticCat(alleyCat); //importantly, copies primary key column
session.saveOrUpdate(domesticCat)
I am wondering if this is supported behavior, first of all, and if it is, perhaps an overview of the mapping file session chemistry that should make it work.
I should mention that deleting the AlleyCat row and inserting a new DomesticCat row works fine, but is less than ideal for my actual scenario.