HHH-16685 Avoid extreme cache misses on EntityPersister#implementsLifecycle()

This commit is contained in:
Sanne Grinovero 2023-05-19 11:11:02 +01:00 committed by Sanne Grinovero
parent 5c60b632a1
commit 57cbaed2a9
1 changed files with 3 additions and 1 deletions

View File

@ -450,6 +450,7 @@ public abstract class AbstractEntityPersister
*/ */
protected final BasicEntityPropertyMapping propertyMapping; protected final BasicEntityPropertyMapping propertyMapping;
private final boolean implementsLifecycle;
@Deprecated(since = "6.0") @Deprecated(since = "6.0")
public AbstractEntityPersister( public AbstractEntityPersister(
@ -504,6 +505,7 @@ public abstract class AbstractEntityPersister
javaType = representationStrategy.getLoadJavaType(); javaType = representationStrategy.getLoadJavaType();
assert javaType != null; assert javaType != null;
this.implementsLifecycle = Lifecycle.class.isAssignableFrom( javaType.getJavaTypeClass() );
final Dialect dialect = creationContext.getDialect(); final Dialect dialect = creationContext.getDialect();
@ -4107,7 +4109,7 @@ public abstract class AbstractEntityPersister
@Override @Override
public boolean implementsLifecycle() { public boolean implementsLifecycle() {
return Lifecycle.class.isAssignableFrom( getMappedClass() ); return this.implementsLifecycle;
} }
@Override @Override