HHH-15662 ClasscastException caused by check for Managed rather than ManagedEntity

This commit is contained in:
Sanne Grinovero 2022-11-03 23:03:57 +00:00 committed by Sanne Grinovero
parent bde7362d9c
commit ca79c91c56
2 changed files with 2 additions and 11 deletions

View File

@ -25,7 +25,6 @@ import java.util.Map;
import java.util.function.Consumer;
import static org.hibernate.engine.internal.ManagedTypeHelper.asManagedEntity;
import static org.hibernate.engine.internal.ManagedTypeHelper.isManaged;
import static org.hibernate.engine.internal.ManagedTypeHelper.isManagedEntity;
/**
@ -95,7 +94,7 @@ public class EntityEntryContext {
ManagedEntity managedEntity = getAssociatedManagedEntity( entity );
final boolean alreadyAssociated = managedEntity != null;
if ( !alreadyAssociated ) {
if ( isManaged( entity ) ) {
if ( isManagedEntity( entity ) ) {
final ManagedEntity managed = asManagedEntity( entity );
if ( entityEntry.getPersister().isMutable() ) {
managedEntity = managed;
@ -155,7 +154,7 @@ public class EntityEntryContext {
}
private ManagedEntity getAssociatedManagedEntity(Object entity) {
if ( isManaged( entity ) ) {
if ( isManagedEntity( entity ) ) {
final ManagedEntity managedEntity = asManagedEntity( entity );
if ( managedEntity.$$_hibernate_getEntityEntry() == null ) {
// it is not associated

View File

@ -56,14 +56,6 @@ public final class ManagedTypeHelper {
return EnhancedEntity.class.isAssignableFrom( type ) || Managed.class.isAssignableFrom( type );
}
/**
* @param entity
* @return true if and only if the entity implements {@see Managed}
*/
public static boolean isManaged(final Object entity) {
return entity instanceof EnhancedEntity || entity instanceof Managed;
}
/**
* @param entity
* @return true if and only if the entity implements {@see ManagedEntity}