mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 00:24:57 +00:00
HHH-7249 - Fix Envers saving the proper discriminator value at deletion time between related entities.
This commit is contained in:
parent
0efd03419e
commit
7552b053db
@ -94,10 +94,14 @@ private void addCollectionChangeWorkUnit(
|
||||
|
||||
if ( value instanceof HibernateProxy ) {
|
||||
final HibernateProxy hibernateProxy = (HibernateProxy) value;
|
||||
toEntityName = session.bestGuessEntityName( value );
|
||||
id = hibernateProxy.getHibernateLazyInitializer().getIdentifier();
|
||||
// We've got to initialize the object from the proxy to later read its state.
|
||||
value = EntityTools.getTargetFromProxy( session.getFactory(), hibernateProxy );
|
||||
// HHH-7249
|
||||
// This call must occur after the proxy has been initialized or the returned name will
|
||||
// be to the base class which will impact the discriminator value chosen when using an
|
||||
// inheritance strategy with discriminators.
|
||||
toEntityName = session.bestGuessEntityName( value );
|
||||
}
|
||||
else {
|
||||
toEntityName = session.guessEntityName( value );
|
||||
|
Loading…
x
Reference in New Issue
Block a user