Search in sources :

Example 1 with InsertEntityCommand

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

Example 2 with InsertEntityCommand

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

the class AbstractBehaviorReadable method createInsertEntityCommand.

// -----------------------------------------------------
// Write
// -----
// defined here (on the readable interface) for non-primary key value
protected InsertEntityCommand createInsertEntityCommand(Entity entity, InsertOption<? extends ConditionBean> option) {
    assertBehaviorCommandInvoker("createInsertEntityCommand");
    final InsertEntityCommand cmd = newInsertEntityCommand();
    xsetupEntityCommand(cmd, entity);
    cmd.setInsertOption(option);
    return cmd;
}
Also used : InsertEntityCommand(org.dbflute.bhv.core.command.InsertEntityCommand)

Aggregations

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