use of org.dbflute.bhv.writable.UpdateOption in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateBatchUpdateNonstrict.
protected int[] delegateBatchUpdateNonstrict(List<? extends Entity> entityList, UpdateOption<? extends ConditionBean> option) {
if (entityList.isEmpty()) {
return EMPTY_INT_ARRAY;
}
final OptionalThing<UpdateOption<? extends ConditionBean>> optOption = createOptionalUpdateOption(option);
adjustEntityListBeforeBatchUpdate(entityList, option, true);
if (entityList.isEmpty()) {
// might be filtered
return EMPTY_INT_ARRAY;
}
final BatchUpdateNonstrictCommand command = createBatchUpdateNonstrictCommand(entityList, 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));
}
}
use of org.dbflute.bhv.writable.UpdateOption 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.writable.UpdateOption in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateQueryUpdate.
protected int delegateQueryUpdate(Entity entity, ConditionBean cb, UpdateOption<? extends ConditionBean> option) {
final OptionalThing<UpdateOption<? extends ConditionBean>> optOption = createOptionalUpdateOption(option);
adjustEntityBeforeQueryUpdate(entity, cb, optOption);
final QueryUpdateCBCommand command = createQueryUpdateCBCommand(entity, cb, option);
final OptionalThing<ConditionBean> optCB = OptionalThing.of(cb);
RuntimeException cause = null;
try {
hookBeforeUpdate(command, entity, optCB, optOption);
return invoke(command);
} catch (RuntimeException e) {
cause = e;
throw e;
} finally {
hookFinallyUpdate(command, entity, optCB, optOption, createOptionalCause(cause));
}
}
use of org.dbflute.bhv.writable.UpdateOption 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);
}
}
use of org.dbflute.bhv.writable.UpdateOption in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateUpdateNonstrict.
protected int delegateUpdateNonstrict(Entity entity, UpdateOption<? extends ConditionBean> option) {
final OptionalThing<UpdateOption<? extends ConditionBean>> optOption = createOptionalUpdateOption(option);
adjustEntityBeforeUpdate(entity, optOption);
final UpdateNonstrictEntityCommand command = createUpdateNonstrictEntityCommand(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));
}
}
Aggregations