public void cascade(EntityPersister persister,
Object parent,
Object anything) throws HibernateException {
if ( persister.hasCascades() || action.requiresNoCascadeChecking() ) { // performance opt
if ( log.isTraceEnabled() ) {
log.trace( "processing cascade " + action + " for: " + persister.getEntityName() );
}
Type[] types = persister.getPropertyTypes();
CascadeStyle[] cascadeStyles = persister.getPropertyCascadeStyles();
EntityMode entityMode = eventSource.getEntityMode();
boolean hasUninitializedLazyProperties = persister.hasUninitializedLazyProperties( parent, entityMode );
for ( int i=0; i< types.length; i++) {
CascadeStyle style = cascadeStyles[i];
if ( hasUninitializedLazyProperties && persister.getPropertyLaziness()[i] && ! action.performOnLazyProperty() ) {
//do nothing to avoid a lazy property initialization
continue;
}
if ( style.doCascade( action ) ) {
cascadeProperty(
persister.getPropertyValue( parent, i, entityMode ),
types[i],
style,
anything,
false
);
}
else if ( action.requiresNoCascadeChecking() ) {
action.noCascade(
eventSource,
persister.getPropertyValue( parent, i, entityMode ),
parent,
persister,
i
);
}
}
if ( log.isTraceEnabled() ) {
log.trace( "done processing cascade " + action + " for: " + persister.getEntityName() );
}
}
}
Cascade an action from the parent entity instance to all its children. This
form is typicaly called from within cascade actions. |