Invalid bound statement (not found)

来源:互联网 发布:杰视帮美工教程 编辑:程序博客网 时间:2024/05/02 08:47

Invalid bound statement (not found)

Mybatis在idea中有时会出现这个错误。常规的思路是:1:检查xml文件中mapper接口的命名空间是否正确,model、modelExample是否对应。2:检查xml文件中的id 和mapper中的接口名称能否对应上idea有个问题就是不会把非resource目录下的xml文件编译进target里面,会出现这个错误。可以在项目设置中设置*mapper.xml文件所在的目录为resource

这里写图片描述

但是这时候如果里面有java文件的话,会出现异常。最好是在*mapper.xml文件所在的工程的pom文件中,指定资源文件。
<build>        <resources>            <resource>                <directory>src/main/resources</directory>            </resource>            <resource>                <filtering>false</filtering>                <directory>src/main/java</directory>                <includes>                    <include>**/*.properties</include>                    <include>**/*.xml</include>                </includes>            </resource>        </resources>    </build>
原创粉丝点击