Search in sources :

Example 1 with BatchInsertCommand

use of org.dbflute.bhv.core.command.BatchInsertCommand in project dbflute-core by dbflute.

the class AbstractBehaviorWritable method createBatchInsertCommand.

// -----------------------------------------------------
// Batch
// -----
protected BatchInsertCommand createBatchInsertCommand(List<? extends Entity> entityList, InsertOption<? extends ConditionBean> option) {
    assertBehaviorCommandInvoker("createBatchInsertCommand");
    final BatchInsertCommand cmd = newBatchInsertCommand();
    setupListEntityCommand(cmd, entityList);
    cmd.setInsertOption(option);
    return cmd;
}
Also used : BatchInsertCommand(org.dbflute.bhv.core.command.BatchInsertCommand)

Example 2 with BatchInsertCommand

use of org.dbflute.bhv.core.command.BatchInsertCommand 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));
    }
}
Also used : BatchInsertCommand(org.dbflute.bhv.core.command.BatchInsertCommand) InsertOption(org.dbflute.bhv.writable.InsertOption) ConditionBean(org.dbflute.cbean.ConditionBean)

Aggregations

BatchInsertCommand (org.dbflute.bhv.core.command.BatchInsertCommand)2 InsertOption (org.dbflute.bhv.writable.InsertOption)1 ConditionBean (org.dbflute.cbean.ConditionBean)1