nordborg wrote:
They way you describe it I don't think it is a bug. A single object instance can only have ONE identity. If you have done like the example in the link you posted you would need TWO different objects if you want both in the same session at the same time. One for the CurrentContract and one for the HistoricalContract.
Hmm, wouldn't it be a valid use case to be able to persist the object to multiple tables in one go, one for the actual Contract, and one for the change history of the contract?
I agree with you that object identity is an important concept in this respect, since Hibernate uses this to flush any changes of the object during transaction completion. However this should not mean you'd have to create a deep copy of the object if you'd like to persists the object to the a second table, which is very error prone when its a large object (or in our case a large object tree!).
Anyway, thanks for clearing this up.
Regards,
Lennard.