ibatis.binding.BindingException Parameter '__frch_item_0' not found

nested exception is org.apache.ibatis.binding.BindingException

之前写代码的时候,想写一个批量的删除,我在mybatis层的xml中的sql是这样写的:

  <delete id="deleteByHpccIds" parameterType="List">
  	delete from pf_hpccdev_info
  	where hpcc_id in
  		<foreach collection="hpccIds" item="item" index="index" open="(" separator="," close=")">
				#{item}
		</foreach> -
  </delete>

然后就报了下面的错误:

Caused by: org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [oprInfo, hpccIds, param1, param2]
	at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:202)
	at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:45)
	at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:122)
	at com.chinacache.common.database.dao.PageInterceptor.setParameters(PageInterceptor.java:401)
	at com.chinacache.common.database.dao.PageInterceptor.doInsert(PageInterceptor.java:309)
	at com.chinacache.common.database.dao.PageInterceptor.interceptDelete(PageInterceptor.java:282)
	at com.chinacache.common.database.dao.PageInterceptor.intercept(PageInterceptor.java:69)
	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
	at com.sun.proxy.$Proxy458.prepare(Unknown Source)
	at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85)
	at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
	at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
	at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
	at org.apache.ibatis.session.defaults.DefaultSqlSession.delete(DefaultSqlSession.java:213)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)

其实就是这样一个简单的删除,但是不知道问题出在哪了,后来想着把xml中的sql改一下,其实就是抱着试试的想法,然后就好了,改过之后的sql:

  <delete id="deleteByHpccIds" parameterType="List">
  	delete from pf_hpccdev_info
  	where hpcc_id in
		 <foreach collection="hpccIds" item="item" index="index" open="(" separator="," close=")">
				#{hpccIds[${index}],jdbcType=INTEGER}
		</foreach>
  </delete>

虽然把问题解决了,但不知道第一个sql的写法为什么不行!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值