转载:Maven项目mybatis Invalid bound statement (not found)解决方法
在mapper代理的开发中,程序员需要遵守一些规范,mybatis才能实现mapper接口的代理对象。
它的规范如下:
- mapper.xml的namespace要写所映射接口的全称类名。
- mapper.xml中的每个statement的id要和接口方法的方法名相同
- mapper.xml中定义的每个sql的parameterType要和接口方法的形参类型相同
- mapper.xml中定义的每个sql的resultType要和接口方法的返回值的类型相同
- mapper.xml要和对应的mapper接口在同一个包下
- mapper.xml的命名规范遵守: 接口名+Mapper.xml
如果以上检查完毕,项目都遵守了上述的规范,而且你的项目是Maven项目。但是运行程序还是会出现Mybatis invalid bound statement(not found)的问题,这个时候就需要修改pom.xml文件了。在pom.xml中添加如下的代码:
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<!-- 此配置不可缺,否则mybatis的Mapper.xml将会丢失 -->
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!--指定资源的位置-->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
转载:Maven项目mybatis Invalid bound statement (not found)解决方法的更多相关文章
- Maven项目mybatis Invalid bound statement (not found)解决方法
最近因为工作需要,要学习mybatis框架.在添加好一些依赖之后,通过mybatis进行数据库的crud操作.但是在测试的时候总是报mybatis:Invalid bound statement (n ...
- maven项目:Invalid bound statement
在使用maven做mybatis项目时会遇到这个问题, org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- MyBatis笔记----报错:Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决方法
报错 Exception in thread "main" org.apache.ibatis.binding.BindingException: Invalid bound st ...
- Invalid bound statement (not found)解决方法
项目背景:SSM框架,MySQL数据库 报错情况: 错误原因:Mybatis的xml文件中,namespace路径错误!!引入的不是对应的Dao接口!!! Dao接口和对应的xml文件 必须一一对应! ...
- mybatis invalid bound statement (not found)
Spring boot + Mybatis : Invalid bound statement (not found) 如果只在启动类上配置@MapperScan注解,默认只扫描和mapper接口同名 ...
- MyBatis: Invalid bound statement (not found)错误的可能原因
MyBatis: Invalid bound statement (not found)错误的可能原因 其他原因导致此问题解决参考: 1.检查 xml 文件所在 package 名称是否和 Mappe ...
- maven 项目报错org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)解决
idea在使用maven构建的项目中使用mybatis时报错org.apache.ibatis.binding.BindingException: Invalid bound statement (n ...
- mybatis Invalid bound statement (not found)错误解决办法
由于新版的IntelliJ IDEA不再编译source folder下的xml文件,而我们平时使用mybatis时,习惯于将*Mapper.xml文件放在与dao层.service层平级的src目录 ...
- invalid bound statement (not found)解决办法
最近搭建一个web项目后端SSM框架练手,使用Maven管理,遇到一个深坑invalid bound statement (not found),就是mapper文件扫描不到!!! 先上整合过程,解决 ...
随机推荐
- 【Arduino】旋转编码器的Arduino使用方法
以前用CRT显示器的时候,调整显示器的时候用一个圆盘转动和点击的方法就可以实现选择菜单和修改设置项的值,比多个按钮的方式方便很多. 鼠标滚轮也是这种操作方法,旋转+点击,只是方向不同.最近在网上买了旋 ...
- php 读取输出其他文件的方法
ob_start();iconv('utf-8','gb2312',readfile('1.html')); //直接输出文本内容echo '<hr>'; $data = file_get ...
- Your intuition 你的直觉
If you’re thinking just like everyone else, you aren’t really thinking. Follow your intuition. Do wh ...
- Install Jenkins Slave as Windows Service
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service SC 直接创建windows s ...
- YbSoftwareFactory 代码生成插件【二十二】:CMS基础功能的实现
很多网友建议在YbRapidSolution for MVC框架的基础上实现CMS功能,以方便进行内容的管理,加快前端页面的开发速度.因此花了一段时间,实现了一套CMS内容发布系统并已集成至YbRap ...
- 解决ADB server didn't ACK问题,连上手机问题
出现如下情况 ADB server didn't ACK* failed to start daemon * 解决办法: 方法一: (1)查看任务管理器,关闭所有adb.exe,或者运行->cm ...
- VIM配置与管理
VIM是写代码的神器,个人觉得比sublime更强,详情http://zh.wikipedia.org/wiki/Vim.如果用网游做类比,没有经过打造的VIM,也只能算是一只非常有潜力的0级宠物,经 ...
- PHP命令行脚本接收传入参数的三种方式
通常PHP都做http方式请求了,可以使用GET or POST方式接收参数,有些时候需要在shell命令下把PHP当作脚本执行,比如定时任务.这就涉及到在shell命令下如何给php传参的问题,通常 ...
- Linux tcpdump命令详解
tcpdump官网:http://www.tcpdump.org/ 转载于:http://www.cnblogs.com/ggjucheng/archive/2012/01/14/2322659.ht ...
- asp值mysql驱动
http://www.sufeinet.com/thread-10278-1-1.html%20http://tool.sufeinet.com/CodePreview/CodeView.aspx?a ...