java ibatis in/out参数问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1530703/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 16:57:07  来源:igfitidea点击:

ibatis in/out parameter problem

javaibatisout-parameters

提问by mykola

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"?

我无法理解第二个程序和/或其映射有什么问题。“INOUT”会不会有问题?

回答by mykola

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. :)

它正在工作!刚刚将 id 属性的 jdbcType 更改为 NUMERIC 并且它起作用了!不幸的是,我不再需要它了。:)

回答by Rahul

What value are you passing for the INOUT parameter ? My guess is that you need to provide a default value for it.

你为 INOUT 参数传递了什么值?我的猜测是您需要为它提供一个默认值。