mybatis '__frch_item_0' not found.

看了网上一些使用Mybatis往Oracle批量插入数据的文章,打算使用insert ALL 方式试一下。

结果在执行的时候报错:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_p_0' not found. Available parameters are [list]

为了搞清楚为什么会报这个错,使用idea添加BindingException异常断点,重写执行到异常位置,
mybatis '__frch_item_0' not found._第1张图片

这里可以看出,this指向一个map,现在要在这个从这个map里取出key为
__frch_p_0的对象,但是这个map里只有一个list,这个list是我传给sql的List。正常应该是从list取对象,然后调用对象的所有get方法才对。带着问题,往上查看函数栈,

mybatis '__frch_item_0' not found._第2张图片

这个函数里边终于确定问题所在,在boundSql.hasAdditionalParameter(propertyName)时返回了false,导致走到else分支,最总导致报错。而返回false是因为hasAdditionalParameter会去判断有没有propertyName属性对应的get方法,结果没找到。(因为我在xml中写错了,应该是grantRatio,而不是grantRatio1)。
image.png

至此问题确定。

你可能感兴趣的:(mybatis,oracle)