HHH-15776 Avoid type checking for ManagedEntity in EntityEntryContext#deserialize as well

This commit is contained in:
Sanne Grinovero 2022-11-28 16:33:56 +00:00 committed by Sanne Grinovero
parent c882699557
commit e4c294f4b6
1 changed files with 4 additions and 3 deletions

View File

@ -460,16 +460,17 @@ public class EntityEntryContext {
final ManagedEntity managedEntity;
if ( isEnhanced ) {
if ( entry.getPersister().isMutable() ) {
managedEntity = (ManagedEntity) entity;
managedEntity = ManagedTypeHelper.asManagedEntity( entity );
}
else {
managedEntity = new ImmutableManagedEntityHolder( (ManagedEntity) entity );
final ManagedEntity castedEntity = asManagedEntity( entity );
managedEntity = new ImmutableManagedEntityHolder( castedEntity );
if ( context.immutableManagedEntityXref == null ) {
context.immutableManagedEntityXref =
new IdentityHashMap<>();
}
context.immutableManagedEntityXref.put(
(ManagedEntity) entity,
castedEntity,
(ImmutableManagedEntityHolder) managedEntity
);