use of org.dbflute.bhv.core.command.BatchUpdateCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method createBatchUpdateCommand.
protected BatchUpdateCommand createBatchUpdateCommand(List<? extends Entity> entityList, UpdateOption<? extends ConditionBean> option) {
assertBehaviorCommandInvoker("createBatchUpdateCommand");
final BatchUpdateCommand cmd = newBatchUpdateCommand();
setupListEntityCommand(cmd, entityList);
cmd.setUpdateOption(option);
return cmd;
}
use of org.dbflute.bhv.core.command.BatchUpdateCommand in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateBatchUpdate.
protected int[] delegateBatchUpdate(List<? extends Entity> entityList, UpdateOption<? extends ConditionBean> option) {
if (entityList.isEmpty()) {
return EMPTY_INT_ARRAY;
}
if (asDBMeta().hasOptimisticLock()) {
adjustEntityListBeforeBatchUpdate(entityList, option, false);
if (entityList.isEmpty()) {
// might be filtered
return EMPTY_INT_ARRAY;
}
final BatchUpdateCommand command = createBatchUpdateCommand(entityList, option);
final OptionalThing<UpdateOption<? extends ConditionBean>> optOption = createOptionalUpdateOption(option);
RuntimeException cause = null;
try {
hookBeforeUpdate(command, entityList, emptyOpt(), optOption);
return invoke(command);
} catch (RuntimeException e) {
cause = e;
throw e;
} finally {
hookFinallyUpdate(command, entityList, emptyOpt(), optOption, createOptionalCause(cause));
}
} else {
return delegateBatchUpdateNonstrict(entityList, option);
}
}
Aggregations