HHH-15776 Avoid type checking for ManagedEntity in StatefulPersistenceContext#addReferenceEntry

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

View File

@ -68,6 +68,7 @@ import org.hibernate.type.CollectionType;
import org.jboss.logging.Logger;
import static org.hibernate.engine.internal.ManagedTypeHelper.asManagedEntity;
import static org.hibernate.engine.internal.ManagedTypeHelper.asPersistentAttributeInterceptable;
import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttributeInterceptable;
@ -577,9 +578,9 @@ public class StatefulPersistenceContext implements PersistenceContext {
public void addReferenceEntry(
final Object entity,
final Status status) {
((ManagedEntity)entity).$$_hibernate_getEntityEntry().setStatus( status );
entityEntryContext.addEntityEntry( entity, ((ManagedEntity)entity).$$_hibernate_getEntityEntry() );
final EntityEntry entityEntry = asManagedEntity( entity ).$$_hibernate_getEntityEntry();
entityEntry.setStatus( status );
entityEntryContext.addEntityEntry( entity, entityEntry );
setHasNonReadOnlyEnties( status );
}