MyBatis:Invalid bound statement (not found)

来源:互联网 发布:青岛软件开发工资待遇 编辑:程序博客网 时间:2024/06/05 16:26

       Invalid bound statement (not found)Exception 这个异常的原因是:
       由于程序在运行的时候会将mapper接口加载到target文件中,但是却没有加载mapper.xml文件到target文件。

解决的方法是在mapper文件所在工程或者模块里面的pom.xml文件里面添加这样的一段代码:

<!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 --><build><resources><resource><directory>src/main/java</directory><includes><include>**/*.properties</include><include>**/*.xml</include></includes><filtering>false</filtering></resource></resources></build>

就可以将mapper.xml文件加载到target文件夹中。在运行项目的前后你可以打开target文件夹,看项目运行前后mapper.xml文件是否有加载

到文件夹中,就可以判定错误的具体原因了!

   

0 0
原创粉丝点击