Search in sources :

Example 1 with QueryInsertCBCommand

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

the class AbstractBehaviorWritable method delegateQueryInsert.

// -----------------------------------------------------
// Query Update
// ------------
protected int delegateQueryInsert(Entity entity, ConditionBean inCB, ConditionBean resCB, InsertOption<? extends ConditionBean> option) {
    final OptionalThing<InsertOption<? extends ConditionBean>> optOption = createOptionalInsertOption(option);
    adjustEntityBeforeQueryInsert(entity, inCB, resCB, optOption);
    final QueryInsertCBCommand command = createQueryInsertCBCommand(entity, inCB, resCB, option);
    final OptionalThing<ConditionBean> optInCB = OptionalThing.of(inCB);
    RuntimeException cause = null;
    try {
        hookBeforeInsert(command, entity, optInCB, optOption);
        return invoke(command);
    } catch (RuntimeException e) {
        cause = e;
        throw e;
    } finally {
        hookFinallyInsert(command, entity, optInCB, optOption, createOptionalCause(cause));
    }
}
Also used : QueryInsertCBCommand(org.dbflute.bhv.core.command.QueryInsertCBCommand) InsertOption(org.dbflute.bhv.writable.InsertOption) ConditionBean(org.dbflute.cbean.ConditionBean)

Example 2 with QueryInsertCBCommand

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

the class AbstractBehaviorWritable method createQueryInsertCBCommand.

// -----------------------------------------------------
// Query
// -----
protected QueryInsertCBCommand createQueryInsertCBCommand(Entity entity, ConditionBean intoCB, ConditionBean resourceCB, InsertOption<? extends ConditionBean> option) {
    assertBehaviorCommandInvoker("createQueryInsertCBCommand");
    final QueryInsertCBCommand cmd = new QueryInsertCBCommand();
    cmd.setTableDbName(asTableDbName());
    _behaviorCommandInvoker.injectComponentProperty(cmd);
    cmd.setEntity(entity);
    cmd.setIntoConditionBean(intoCB);
    cmd.setConditionBean(resourceCB);
    cmd.setInsertOption(option);
    return cmd;
}
Also used : QueryInsertCBCommand(org.dbflute.bhv.core.command.QueryInsertCBCommand)

Aggregations

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