Fix StateleSession call to PostLoadEvent causing NPE

This commit is contained in:
Andrea Boriero 2021-07-13 17:56:35 +02:00
parent 78b8b4aed8
commit 4eb27e61b1
1 changed files with 9 additions and 7 deletions

View File

@ -192,14 +192,16 @@ public class JdbcValuesSourceProcessingStateStandardImpl implements JdbcValuesSo
loadingEntityMap.forEach(
(entityKey, loadingEntityEntry) -> {
postLoadEvent.reset();
postLoadEvent.setEntity( loadingEntityEntry.getEntityInstance() )
.setId( entityKey.getIdentifier() )
.setPersister( loadingEntityEntry.getDescriptor() );
for ( PostLoadEventListener listener : listenerGroup.listeners() ) {
listener.onPostLoad( postLoadEvent );
if ( postLoadEvent != null ) {
postLoadEvent.reset();
postLoadEvent.setEntity( loadingEntityEntry.getEntityInstance() )
.setId( entityKey.getIdentifier() )
.setPersister( loadingEntityEntry.getDescriptor() );
for ( PostLoadEventListener listener : listenerGroup.listeners() ) {
listener.onPostLoad( postLoadEvent );
}
}
executionContext.invokeAfterLoadActions(
getSession(),
loadingEntityEntry.getEntityInstance(),