CacheMode cacheMode = session.getCacheMode();
session.setCacheMode( CacheMode.GET );
session.getPersistenceContext().incrementCascadeLevel();
try {
// cascade-delete to collections BEFORE the collection owner is deleted
new Cascade( CascadingAction.DELETE, Cascade.AFTER_INSERT_BEFORE_DELETE, session )
.cascade( persister, entity, transientEntities );
}
finally {
session.getPersistenceContext().decrementCascadeLevel();
session.setCacheMode( cacheMode );