programming/ibatis mybatis

[ibaitis] mysql select PROCEDURE

labj 2017. 1. 23. 13:27

[ibaitis] mysql select PROCEDURE ibatis


코드1)

- java

    @Override
    public List<Etraininglist> selectEtraininglistList(int code) throws Exception {
        logger.debug("selectEtraininglistList -------------------------->> " + code);
        Map<String, Object> condition = new HashMap<String, Object>();
        condition.put("code", code);
        return sqlMap.queryForList("member.selectEtraininglist", condition);
    }

- ibatis

    <parameterMap class="map" id="selParam">
        <parameter property="code" jdbcType="INT" javaType="java.lang.Integer" mode="IN"/>
    </parameterMap>

    <procedure id="selectEtraininglist" parameterMap="selParam" resultClass="Etraininglist" >
        <![CDATA[
        {CALL USP_Interface_Member_GetEducationCourceByButton(?)}
        ]]>
    </procedure>


코드2)

- java

    @Override
    public List<Etraininglist> selectEtraininglistList(int code) throws Exception {
        logger.debug("selectEtraininglistList -------------------------->> " + code);
        return sqlMap.queryForList("member.selectEtraininglist", code);
    }

- ibatis

    <procedure id="selectEtraininglist"  parameterClass="java.lang.Integer" resultClass="Etraininglist" >
        <![CDATA[
        {CALL USP_Interface_Member_GetEducationCourceByButton(#code#)}
        ]]>
    </procedure>


[ibaitis] mysql select PROCEDURE ibatis