執行mybaits sql
<delete id="delete4BatchesByLineCi" parameterType="java.util.List"> <foreach collection="list" item="item" index="index" separator=";"> -- update VPN_FIREWALL set is_delete = true where where LINE_CI = #{item} delete from VPN_FIREWALL where LINE_CI = #{item, jdbcType=VARCHAR} </foreach> </delete>
提示錯誤:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='__frch_item_0', 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 #2 with JdbcType VARCHAR . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.postgresql.util.PSQLException: 欄位索引超過許可范圍:2,欄位數:1。\
根據網上類似問題解決方案,都不能解決此問題,對比在另一處 這種用法沒有問題,刪除注釋行 ,問題解決。
--update VPN_FIREWALL set is_delete = true where where LINE_CI = #{item}