use of org.dbflute.bhv.core.command.UpdateEntityCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateUpdate.
protected int delegateUpdate(Entity entity, UpdateOption<? extends ConditionBean> option) {
final OptionalThing<UpdateOption<? extends ConditionBean>> optOption = createOptionalUpdateOption(option);
adjustEntityBeforeUpdate(entity, optOption);
if (asDBMeta().hasOptimisticLock()) {
final UpdateEntityCommand command = createUpdateEntityCommand(entity, option);
RuntimeException cause = null;
try {
hookBeforeUpdate(command, entity, emptyOpt(), optOption);
return invoke(command);
} catch (RuntimeException e) {
cause = e;
throw e;
} finally {
hookFinallyUpdate(command, entity, emptyOpt(), optOption, createOptionalCause(cause));
}
} else {
return delegateUpdateNonstrict(entity, option);
}
}
use of org.dbflute.bhv.core.command.UpdateEntityCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method createUpdateEntityCommand.
// ===================================================================================
// Behavior Command
// ================
// -----------------------------------------------------
// Basic
// -----
// an insert command creation is defined on the readable interface for non-primary key value
protected UpdateEntityCommand createUpdateEntityCommand(Entity entity, UpdateOption<? extends ConditionBean> option) {
assertBehaviorCommandInvoker("createUpdateEntityCommand");
final UpdateEntityCommand cmd = newUpdateEntityCommand();
xsetupEntityCommand(cmd, entity);
cmd.setUpdateOption(option);
return cmd;
}
Aggregations