HHH-16825 Cascading an entity with a composite key causes NullPointerException in AbstractClassJavaType.extractHashCode
This commit is contained in:
parent
bf66bc7b78
commit
ec9747983d
|
@ -222,9 +222,7 @@ public class DefaultMergeEventListener
|
||||||
final EventSource session = event.getSession();
|
final EventSource session = event.getSession();
|
||||||
final String entityName = event.getEntityName();
|
final String entityName = event.getEntityName();
|
||||||
final EntityPersister persister = session.getEntityPersister( entityName, entity );
|
final EntityPersister persister = session.getEntityPersister( entityName, entity );
|
||||||
final Object id = persister.hasIdentifierProperty()
|
final Object id = persister.getIdentifier( entity, session );
|
||||||
? persister.getIdentifier( entity, session )
|
|
||||||
: null;
|
|
||||||
final Object copy = copyEntity( copyCache, entity, session, persister, id );
|
final Object copy = copyEntity( copyCache, entity, session, persister, id );
|
||||||
|
|
||||||
// cascade first, so that all unsaved objects get their
|
// cascade first, so that all unsaved objects get their
|
||||||
|
@ -234,10 +232,13 @@ public class DefaultMergeEventListener
|
||||||
copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.FROM_PARENT );
|
copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.FROM_PARENT );
|
||||||
|
|
||||||
saveTransientEntity( copy, entityName, event.getRequestedId(), session, copyCache );
|
saveTransientEntity( copy, entityName, event.getRequestedId(), session, copyCache );
|
||||||
|
persister.setIdentifier( entity, persister.getIdentifier( copy, session ), session );
|
||||||
|
|
||||||
// cascade first, so that all unsaved objects get their
|
// cascade first, so that all unsaved objects get their
|
||||||
// copy created before we actually copy
|
// copy created before we actually copy
|
||||||
super.cascadeAfterSave( session, persister, entity, copyCache );
|
super.cascadeAfterSave( session, persister, entity, copyCache );
|
||||||
|
|
||||||
|
|
||||||
copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.TO_PARENT );
|
copyValues( persister, entity, copy, session, copyCache, ForeignKeyDirection.TO_PARENT );
|
||||||
|
|
||||||
// saveTransientEntity has been called using a copy that contains empty collections
|
// saveTransientEntity has been called using a copy that contains empty collections
|
||||||
|
|
Loading…
Reference in New Issue