Mybatis笔记二:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
2017-03-14 22:27
761 查看
错误异常:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.dao.NarCodeMapper.getNarCode
出现这个原因:Mybatis的Mapper interface和xml文件的定义对应不上
大致通过如下几步来检查:
1.Mapper interface(接口)名称和Mapper xml名称是否保持一致
-------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<mappers>
<mapper resource="com/test/xml/NarCodeMapper.xml"/>
</mappers>
</configuration>
-----------------------------------------------------------
package com.test.dao;
public interface NarCodeMapper {
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
2.Mapper xml中namespace属性值是否和Mapper interface(接口)所在(package名称+接口名称)保持一致。(本人就是在这里大意)
-------------------------------------------------------------------------------------------------------------------------------------------------------
<mapper namespace="com.test.dao.NarCodeMapper">
</mapper>
-----------------------------------------------------------
package com.test.dao;
public interface NarCodeMapper {
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
3.Mapper interface(接口)中的函数是否与Mapper xml中(select,update,insert,delete)标签中的id属性值对应
4.去掉xml文件中文注释
5.随意在xml文件中加一个空格或者空行然后保存
出现这个原因:Mybatis的Mapper interface和xml文件的定义对应不上
大致通过如下几步来检查:
1.Mapper interface(接口)名称和Mapper xml名称是否保持一致
-------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<mappers>
<mapper resource="com/test/xml/NarCodeMapper.xml"/>
</mappers>
</configuration>
-----------------------------------------------------------
package com.test.dao;
public interface NarCodeMapper {
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
2.Mapper xml中namespace属性值是否和Mapper interface(接口)所在(package名称+接口名称)保持一致。(本人就是在这里大意)
-------------------------------------------------------------------------------------------------------------------------------------------------------
<mapper namespace="com.test.dao.NarCodeMapper">
</mapper>
-----------------------------------------------------------
package com.test.dao;
public interface NarCodeMapper {
}
-------------------------------------------------------------------------------------------------------------------------------------------------------
3.Mapper interface(接口)中的函数是否与Mapper xml中(select,update,insert,delete)标签中的id属性值对应
4.去掉xml文件中文注释
5.随意在xml文件中加一个空格或者空行然后保存
相关文章推荐
- MyBatis笔记----报错Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.ij34.model.UserMapper.selectUser
- MyBatis笔记----报错:Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方法
- 关于mybatis “org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)” 错误的问题
- mybatis的org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- Maven 遇到mybatis 发生org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- spring mybatis集成报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- mybatis: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- mybatis “org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)”
- mybatis错误:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- 关于mybatis的org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- 当mybatis整合spring后出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- mybatis出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- MyBatis Error:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)(IDEA)
- 关于mybatis的org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- mybatis+springmvc:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- mybatis整合springmvc时的错误org.apache.ibatis.binding.BindingException: Invalid bound statement (not found
- spring boot 整合mybatis org.apache.ibatis.binding.BindingException: Invalid bound statement(not found)
- mybatis maven打包出现org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)错误
- mybatis绑定错误:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误