use of org.dbflute.cbean.ConditionBean 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.cbean.ConditionBean 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.cbean.ConditionBean 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.cbean.ConditionBean in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateBatchInsert.
// -----------------------------------------------------
// Batch Update
// ------------
protected int[] delegateBatchInsert(List<? extends Entity> entityList, InsertOption<? extends ConditionBean> option) {
if (entityList.isEmpty()) {
return EMPTY_INT_ARRAY;
}
final OptionalThing<InsertOption<? extends ConditionBean>> optOption = createOptionalInsertOption(option);
adjustEntityListBeforeBatchInsert(entityList, option);
if (entityList.isEmpty()) {
// might be filtered
return EMPTY_INT_ARRAY;
}
final BatchInsertCommand command = createBatchInsertCommand(entityList, option);
RuntimeException cause = null;
try {
hookBeforeInsert(command, entityList, emptyOpt(), optOption);
return invoke(command);
} catch (RuntimeException e) {
cause = e;
throw e;
} finally {
hookFinallyInsert(command, entityList, emptyOpt(), optOption, createOptionalCause(cause));
}
}
use of org.dbflute.cbean.ConditionBean in project dbflute-core by dbflute.
the class AbstractBehaviorWritable method delegateInsert.
// ===================================================================================
// Delegate to Command
// ===================
// -----------------------------------------------------
// Entity Update
// -------------
protected int delegateInsert(Entity entity, InsertOption<? extends ConditionBean> option) {
final OptionalThing<InsertOption<? extends ConditionBean>> optOption = createOptionalInsertOption(option);
adjustEntityBeforeInsert(entity, optOption);
final InsertEntityCommand command = createInsertEntityCommand(entity, option);
RuntimeException cause = null;
try {
hookBeforeInsert(command, entity, emptyOpt(), optOption);
return invoke(command);
} catch (RuntimeException e) {
cause = e;
throw e;
} finally {
hookFinallyInsert(command, entity, emptyOpt(), optOption, createOptionalCause(cause));
}
}
Aggregations