mybatis 异常处理:Invalid bound statement (not found)
mybatis 的使用过程中提示错误:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.msunsoft.mapper.HisLisReportMapper.getMaxMtcData
含义:HisLisReportMapper的getMtcData方法没有找到或者没有绑定
背景:
1.HisLisReportSyncWorker 控制类中
String hospitalCode = ConfigRead.getValue("config.properties",
"HOSPITAL_CODE");
List<Integer> updateIdList = new ArrayList<>();
HisLisReportService hisLisReportService = (HisLisReportService) DataVisitorHolder
.getVisitorMap().get("hisLisReportService");
HashMap<Object, Object> maxHisLisReportMap = hisLisReportService
.getMaxMtcData(hospitalCode);
HashMap<Object, Object> map = hisLisReportService
.getMaxChangeVersion(hospitalCode);
HisLisReportServiceImpl
@Override
@DataSource(name="blSql35")
public HashMap<Object, Object> getMaxChangeVersion(String hospitalCode)
throws Exception {
// TODO Auto-generated method stub
return hisLisReportMapper.getMaxChangeVersion(hospitalCode);
}
HisLisReportMapper 代码
@Override
public HashMap<Object, Object> getMaxChangeVersion(String hospitalCode)
throws Exception ;
HisLisReportService 代码
@Override
public HashMap<Object, Object> getMaxChangeVersion(String hospitalCode)
throws Exception ;
Mybatis.xml文件
<select id="getMaxChangeVersion" parameterType="java.lang.String" resultType="java.util.HashMap">
select
max(sys_change_version) as MAXVERSION ,max(etl_id) as MAXID from
ETL.DBO.ETL_CHARGE_RECORD where hospital_code=#{hospitalCode} and etl_table='lismain.lisdata.report_main'
</select>
<select id="getMaxMtcData" parameterType="java.lang.String" resultType="java.util.HashMap">
select max(his_lis_report_id) as MAXID from his_lis_report where hospital_code=#{hospital_code}
</select>
错误处理流程:
我这里使用的SSM,spingMvc ,mybatis ,maven来构建项目,项目中使用了HisLisReportSyncWorker的控制类,HisLisReportServiceImpl代码实现,HisLisReportService接口类,HisLisReportMapper 的mapper类以及HisLisReportMapper.xml配置文件
1.检查实现类中方法是否存在
2。检查Service类的这个方法是否存在
3.检查Mapper类的这个方法
4.对应的mybatis 的配置文件是否存在,里面数据是否配置正确
5.检查Mapper类是否被加载了
这个错误主要是因为在config的配置文件中没有加载这个xml文件
mybatis 异常处理:Invalid bound statement (not found)的更多相关文章
- mybatis:Invalid bound statement (not found)
[常规解决办法] 如果出现: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 一般的原因 ...
- MyBatis错误--Invalid bound statement (not found)
今天在开发项目的时候使用MyBatis发生错误:Invalid bound statement (not found) 具体错误信息: org.springframework.beans.factor ...
- mybatis错误Invalid bound statement (not found) 的解决办法
<!-- IDEA需要添加一下内容,否则无法找到mapper --> <build> <resources> <resource> <direct ...
- mybatis 报Invalid bound statement(not found) 和 Property 'mapperLocations' was not specified or not matching resources found
排除问题的步骤: 1.首先检查mapper文件和mapper接口的文件名是否相等. 2.pom.xml是否把xml排除了,这样写就会src/main/java下所有的Mybatis的xml文件都删除, ...
- myBatis中Invalid bound statement (not found)错误
环境:Idea.ssm.maven 由于使用maven的原因,maven不会扫描到mapper的xml文件所以会出现此类问题. 每次走到mapper方法时就抛异常:Invalid bound stat ...
- 解决Mybatis的invalid bound statement (not found)异常
使用Maven构建SSM时, 需要在pom.xml中配置一些信息, 否则mapper.xml就无法被扫描到, 程序就会抛invalid bound statement (not found)异常 解决 ...
- 关于 Mybatis 的Invalid bound statement (not found):错误
今天遇到一个特别奇怪的问题,最后发现是自己对mybatis的学习还有待提高 返回类型可以用resultType,也可以用resultMap resultType是直接表示返回类型的,而resultMa ...
- mybatis BindingException: Invalid bound statement (not found)
错误截图 解决措施 此异常的原因是由于mapper接口编译后在同一个目录下没有找到mapper映射文件而出现的. 通常我们在配置SqlSessionFactory时会有如配置 <!-- 配置Sq ...
- mybatis报Invalid bound statement (not found) 分析
解决问题的步骤,请参考: 1.mapper.xml要和对应的mapper接口在同一个包下,包名要一模一样. 2.Mapper接口中的方法在Mapper.xml中没有,然后执行Mapper接口的方法 ...
- idea的spring整合基于xml文件配置的mybatis报Invalid bound statement (not found): com.music.dao.MusicDao.findAll的问题
一. 题主当时就是自己尝试整合spring和mybatis的时候遇到了这个问题,当时题主只看到了用注解的方式配置的dao层,题主用的是xml文件配置的形式, 而且坑爹的是题主的两个文件的路径写的也不一 ...
随机推荐
- byte和int转换
byte b1=1,b2=2,b3,b6; final byte b4=4,b5=6; b6=b4+b5; b3=(b1+b2); System.out.println(b3+b6); b3=b1+b ...
- bzoj2229: [Zjoi2011]最小割(最小割树)
传送门 这题是用最小割树做的(不明白最小割树是什么的可以去看看这一题->这里) 有了最小割树就很简单了……点数那么少……每次跑出一个最大流就暴力搞一遍就好了 //minamoto #includ ...
- 《算法竞赛进阶指南》1.4Hash
137. 雪花雪花雪花 有N片雪花,每片雪花由六个角组成,每个角都有长度. 第i片雪花六个角的长度从某个角开始顺时针依次记为ai,1,ai,2,-,ai,6. 因为雪花的形状是封闭的环形,所以从任何一 ...
- jdk的卸载
问题描述: win10环境安装了jdk1.7&jdk1.8&jdk1.9 jdk1.9安装后,设置jdk1.9安装目录为JAVA_HOME.后来JAVA_HOME切换jdk1.8环境变 ...
- 给奇数的li标签添加蓝色,给偶数的li标签添加红色
今天遇到的面试题,哎,不看参考手册还是写的蛋疼啊!给奇数的li标签添加红色,给偶数的li标签添加蓝色 直接撸代码吧: <!DOCTYPE html> <html lang=" ...
- c# 手动实现 \u 转义字符。。效果。。。
string s ="\\u"+item.Icon; // item.Icon = UnicodeEncoding.Unicode.GetString(UnicodeEncodin ...
- 用servlet获取IP等信息
Locale languageType=request.getLocale();//获取用户语言 String localIp=request.getLocalAddr();//获取本地ip int ...
- C#基础之类型和成员基础以及常量、字段、属性
首先吐糟一下今天杭州的天气,真是太热了!虽然没有妹子跟我约会,但宅在方寸大的窝里,也是烦躁不已! 接上一篇<C#基础之基本类型> 类型和成员基础 在C#中,一个类型内部可以定义多种成员:常 ...
- 在startup中遍历程序集
在aspnetcore中是可以使用AppDomain的,如:在ConfigureServices中,可以使用以下代码获取项目引用的所有dll, var assemblies = AppDomain.C ...
- JVM基础知识1--JAVA内存区域与内存溢出异常
1,运行时数据区域 根据JAVA虚拟机规范的规定:JAVA虚拟机所管理的内存将会包括以下几个运行时数据区域 程序计数器(Program Counter Register)是一块较小的内存空间,它的作用 ...