LH2017
2022-03-07 14:57
采纳率: 100%
浏览 141

mybatis传参报错 java.sql.SQLException: 无效的列索引

<if test="qysSignStatus != null and qysSignStatus !=''">
    AND DLCFAI.STATUS_CODE = #{qysSignStatus,jdbcType=VARCHAR}
</if>

使用mybatis,在传参qysSignStatus时,报错 Caused by: java.sql.SQLException: 无效的列索引
更具体的错误信息如下:

org.apache.ibatis.type.TypeException: 
Could not set parameters for mapping: 
ParameterMapping{property='qysSignStatus', mode=IN, javaType=class java.lang.String, jdbcType=VARCHAR, 
numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. 

Cause: org.apache.ibatis.type.TypeException: 
Error setting non null for parameter #1 with JdbcType VARCHAR . 
Try setting a different JdbcType for this parameter or a different configuration property. 
Cause: java.sql.SQLException: 无效的列索引
<select id="selectContractSettles" resultMap="BaseResultMap" parameterType="dms.core.sale.dto.SaleContractSettle">

参数传递用的是POJO,qysSignStatus属性类型为String类型,在POJO中设置了该属性,且有get和set方法,没有拼写错误,传参时有值不为空,SQL在Navicat中赋上值后可以正常查询
百思不得其解,网上也没找到类似的问题,求帮忙解惑!

4条回答 默认 最新

相关推荐 更多相似问题