HHH-14869 Fix CallbackRegistryImpl#registerCallbacks considering all given callbacks have the same type

This commit is contained in:
Yoann Rodière 2021-10-12 19:03:15 +02:00
parent 965f5bd925
commit 8afce5b5ed
1 changed files with 8 additions and 6 deletions

View File

@ -41,13 +41,15 @@ final class CallbackRegistryImpl implements CallbackRegistryImplementor {
return;
}
final HashMap<Class, Callback[]> map = determineAppropriateCallbackMap( callbacks[0].getCallbackType() );
for ( Callback callback : callbacks ) {
final HashMap<Class, Callback[]> map = determineAppropriateCallbackMap( callback.getCallbackType() );
Callback[] entityCallbacks = map.get( entityClass );
if ( entityCallbacks != null ) {
callbacks = ArrayHelper.join( entityCallbacks, callbacks );
if ( entityCallbacks == null ) {
entityCallbacks = new Callback[0];
}
entityCallbacks = ArrayHelper.join( entityCallbacks, callback );
map.put( entityClass, entityCallbacks );
}
map.put( entityClass, callbacks );
}
@Override