use of org.dbflute.bhv.core.command.DeleteEntityCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateDelete.
protected int delegateDelete(Entity entity, DeleteOption<? extends ConditionBean> option) {
final OptionalThing<DeleteOption<? extends ConditionBean>> optOption = createOptionalDeleteOption(option);
adjustEntityBeforeDelete(entity, optOption);
if (asDBMeta().hasOptimisticLock()) {
final DeleteEntityCommand command = createDeleteEntityCommand(entity, option);
final OptionalThing<Object> optEntity = OptionalThing.of(entity);
RuntimeException cause = null;
try {
hookBeforeDelete(command, optEntity, emptyOpt(), optOption);
return invoke(command);
} catch (RuntimeException e) {
cause = e;
throw e;
} finally {
hookFinallyDelete(command, optEntity, emptyOpt(), optOption, createOptionalCause(cause));
}
} else {
return delegateDeleteNonstrict(entity, option);
}
}
use of org.dbflute.bhv.core.command.DeleteEntityCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method createDeleteEntityCommand.
protected DeleteEntityCommand createDeleteEntityCommand(Entity entity, DeleteOption<? extends ConditionBean> option) {
assertBehaviorCommandInvoker("createDeleteEntityCommand");
final DeleteEntityCommand cmd = newDeleteEntityCommand();
xsetupEntityCommand(cmd, entity);
cmd.setDeleteOption(option);
return cmd;
}
Aggregations