Search code examples
mysqlstored-proceduresibatis

Calling Stored Procedure using iBatis


I have the following iBatis statement:

<select id="validateLogin" parameterType="Account" statementType="CALLABLE">
    { CALL PROC_LOGIN
        (
            #{account_name, jdbcType=VARCHAR, mode=IN},
            #{password, jdbcType=VARCHAR, mode=IN},
            #{fname, jdbcType=VARCHAR, mode=OUT},
            #{lname, jdbcType=VARCHAR, mode=OUT},
            #{account_name, jdbcType=VARCHAR, mode=OUT},
            #{status, jdbcType=INTEGER, mode=OUT},
            #{loginStatus, jdbcType=VARCHAR, mode=OUT}
        )
    }
</select>

However I'm getting, Attribute "parameterType" must be declared for element type "select" and Attribute "statementType" must be declared for element type "select".

I'm new to iBatis and I haven't had much look searching on the internet on how to resolve this.


Solution

  • Try calling it using "procedure" and "parameterMap" tags. Example (more information here):

    <procedure id="getEmpInfo" resultClass="Employee" parameterMap="getEmpInfoCall">
       { call getEmp( #acctID# ) } 
    </procedure>
    <parameterMap id="getEmpInfoCall" class="map">
       <parameter property="acctID" jdbcType="INT" javaType="java.lang.Integer" mode="IN"/>
    </parameterMap>