| There are two places in Cascade class where unnecessary calls to the Reflection API are made: 1. In the method Cascade#cascade(CascadingAction, CascadePoint, EventSource, EntityPersister, Object, Object): When the CascadingAction PERSIST_ON_FLUSH is used, then for some CascadeStyles of a property the method CascadingAction#noCascade may be called. This method requires now the current value of a property. But the property value is only used when the property type is an EntityType. Therefore we can reduce the number of calls to the Reflection API if we change the signature of the method CascadingAction#noCascade to take the property type instead of the property value and the property value can be looked up in the CascadingAction#noCascade if it is really needed. 2. In the method Cascade#cascadeComponent(CascadingAction, CascadePoint, EventSource, int, Object, Object, CompositeType, Object): Here is a similar problem: not all CascadeStyles of a component property require cascading. There are situations where all CascadeStyles of all component properties do not require cascading. Therefore we can delay getting the property values of a component until they are needed and reduce so the number of calls to the Reflection API. |