Insert
1. Process
-
When adding an SQL ID, if you use insert* as the prefix, the statement type is automatically changed to insert.
-
After clicking the [Basic SQL] button, search for the SMP_EMP_TST table and click the OK button; then the INSERT SQL is generated automatically.
-
Add the input type and save it. The DSmpEmpTst000Dto IO created when making the single-search service sample was reused.
-
The output type is automatically set to int.
2. DBIO Sample
INSERT INTO SMP_EMP_TST /* Sample Employee Information TST */
(
FEDU_EMP_NO /* FW Sample Employee Number */
, FEDU_EMP_NM /* FW Sample Employee Name */
, FEDU_OCCP_NM /* FW Sample Occupation Name */
, FEDU_MNGR_EMP_NO /* FW Sample Manager Employee Number */
, FEDU_IPSA_DT /* FW Sample Hire Date */
, FEDU_PAY_AMT /* FW Sample Pay Amount */
, FEDU_DEPT_NO /* FW Sample Department Number */
)
VALUES
(
#{feduEmpNo} /* FW Sample Employee Number */
, #{feduEmpNm} /* FW Sample Employee Name */
, #{feduOccpNm} /* FW Sample Occupation Name */
, #{feduMngrEmpNo} /* FW Sample Manager Employee Number */
, #{feduIpsaDt} /* FW Sample Hire Date */
, #{feduPayAmt} /* FW Sample Pay Amount */
, #{feduDeptNo} /* FW Sample Department Number */
)
3. Bean Sample
@BxmCategory(logicalName = "Single Insert")
public int addEmpInf(DSmpEmpTst000Dto input) throws DefaultApplicationException {
logger.debug("============== START ==============");
logger.debug("input = {}", input);
int addCnt = 0;
dSmpEmpTst000 = DefaultApplicationContext.getBean(dSmpEmpTst000, DSmpEmpTst000.class);
/**
* @BXMType Try
* @Desc Check duplicate employee id
*/
try {
/**
* @BXMType DbioCall
* @Desc insert a single employe info
*/
addCnt = dSmpEmpTst000.insert00(input);
} catch (DasDuplicateKeyException de) {
/**
* @BXMType ApplicationException
* @Desc throw application exception if employee id is already exists
*/
throw new DefaultApplicationException("BXME60007", new Object[] { input.getFeduEmpNo() } );
}
logger.debug("output = {}", addCnt);
logger.debug("============== END ==============");
return addCnt;
}