mybatis中Invalid bound statement (not found) 和 Result Maps collection already contains value for...错误

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis中Invalid bound statement (not found) 和 Result Maps collection already contains value for...错误相关的知识,希望对你有一定的参考价值。

一.Invalid bound statement (not found)

使用mybatis有时候会报Invalid bound statement (not found)这种错误,总结了下,可能有两种情况如下:

1.mybatis的对应的mapper.xml找不到对应的命名sql或者名称与mapper接口名称不一致。

 

2.xml文件与接口名称都对,但是在mybatis配置文件中漏掉了配置,也会报这种错误。

 

二.Result Maps collection already contains value for。。。

有朋友说,把mybatis中的mappers属性去掉就好了,但是,如果*mapper.xml文件与mapper接口不在一个包下,是不能去掉的,如果spring中也没有配置,那么就会报错,

有时候配置都对了,但是还是报这个错,,后来做过试验,将*mapper.xml文件全部删掉,重新生成编译,错误解除,这其实也是一个怪异的问题,有时难免会遇到。

以上是关于mybatis中Invalid bound statement (not found) 和 Result Maps collection already contains value for...错误的主要内容,如果未能解决你的问题,请参考以下文章

mybatis 异常处理:Invalid bound statement (not found)

mybatis 异常处理:Invalid bound statement (not found)

mybatis 异常处理:Invalid bound statement (not found)

SpringBoot 整合Mybatis报错(Invalid bound statement (not found))

mybatis3:Invalid bound statement (not found)

mybatis报错:BindingException: Invalid bound statement (not found)