This is a follow for
HHH-10363 Closed which has already introduced some optimizations to reduce the use of reflection. The method Cascade#cascade(CascadingAction, CascadePoint, EventSource, EntityPersister, Object, Object) still uses unnecessary reflection that has a performance impact. Here's the code in question:
if ( action.deleteOrphans() && !isUninitializedProperty ) {
cascadeLogicalOneToOneOrphanRemoval(
action,
eventSource,
componentPathStackDepth,
parent,
persister.getPropertyValue( parent, i ),
types[ i ],
style,
propertyName,
false
);
}
The cascadeLogicalOneToOneOrphanRemoval method that is called here looks like this:
if ( isLogicalOneToOne( type ) ) {
[..CUT..]
}
This means that the value obtained by getPropertyValue is only used for properties of one-to-one type. To optimize the performance the above test could be made in cascade method before calling persister.getPropertyValue(Object, int). |