ibatis in/out parameter problem

mykola picture mykola · Oct 7, 2009 · Viewed 13k times · Source

Can anyone tell me what's wrong? I have two procedures and two mappings for them. One works fine and another fails. This one works fine:

    <parameterMap id="mapping-descriptions" class="java.util.Map">
        <parameter property="id" javaType="java.lang.Long" jdbcType="NUMBER" mode="IN"/>
        <parameter property="lang" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="shortDesc" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
        <parameter property="fullDesc" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
    </parameterMap>
<procedure id="get-description"
        parameterMap="mapping-descriptions">
        {call COM_DESCRIPTION_PKG.get_desc(?,?,?,?)}
</procedure>

And this one fails:

    <parameterMap id="mapping-description-modifiable" class="java.util.Map">
        <parameter property="id" javaType="java.lang.Long" jdbcType="NUMBER" mode="INOUT"/>
        <parameter property="lang" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="shortDesc" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="fullDesc" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="modify" javaType="boolean" jdbcType="NUMBER" mode="IN"/>
    </parameterMap>
<procedure id="add-description"
        parameterMap="mapping-description-modifiable">
        {call COM_DESCRIPTION_PKG.add_desc(?,?,?,?,?)}
</procedure>

with this exception:

--- The error occurred while executing update procedure.  
--- Check the {call COM_DESCRIPTION_PKG.add_desc(?,?,?,?,?)}.  
--- Check the output parameters (register output parameters failed).  
--- Cause: java.sql.SQLException: Invalid column type: -99999999

I can't understand what's wrong with second procedure and/or its mapping. Can it be some problem with "INOUT"?

Answer

mykola picture mykola · Oct 14, 2009

I've tried to pass a default value but it didn't help


It's working! Just changed jdbcType of id property to NUMERIC and it's worked! Unfortunately i don't need it anymore. :)