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文件配置的形式, 而且坑爹的是题主的两个文件的路径写的也不一 ...
随机推荐
- bash字符串匹配
#!/bin/shfoo(){ local basedir=$1 local all_entries=`ls -c` for entry in $all_entries do ...
- TMF SID中的角色模式
角色模式 Copyright © TeleManagement Forum 2013. All Rights Reserved. This document and translations of i ...
- 计算像素亮度(Pixel Light)
RGB有亮度吗?常用公式: Y(亮度)=(0.299*R)+(0.587*G)+(0.114*B)
- moment.js的方法总结
总结一个非常实用的日期工具类moment.js,日期获取,格式化等. 引入moment //import 方式 import moment from 'moment'; 设定moment区域为中国 / ...
- 使用配置类而不使用XML文件(代替bean.xml)对spring进行配置
以下类是一个配置类,它的作用和bean.xml是一样的注解: @Configuration 作用: 用于指定当前类是一个spring配置类,当创建容器时会从该类上加载注解. 获取容器时需要使用Anno ...
- 动态规划---等和的分隔子集(计蒜课)、从一个小白的角度剖析DP问题
自己还是太菜了,算法还是很难...这么简单的题目竟然花费了我很多时间...在这里我用一个小白的角度剖析一下这道题目. 晓萌希望将1到N的连续整数组成的集合划分成两个子集合,且保证每个集合的数字和是相等 ...
- ASP.NET控件之RegularExpressValidator控件
作用:对Textbox或者其他输入框进行正则验证: 属性:ControlToValidate:要验证的控件: ErrorMessage:错误提示信息: ValidationExpression:正则表 ...
- Java Script 第一章.
什么是Java script? JavaScript是一种基于对象的脚本语言,用于开发基于客户端和基于服务器的Internet应用程序 JavaScript是一种脚本语言(脚本语言是一种轻量级的编程语 ...
- 对sass通过compass进行编译
1.创建一个Compass项目:compass create myproject 其中myproject是项目名称.2.编写scss文件.3.编译成css文件:①:Compass的编译命令是:comp ...
- FZU Problem 2238 Daxia & Wzc's problem
Daxia在2016年5月期间去瑞士度蜜月,顺便拜访了Wzc,Wzc给他出了一个问题: Wzc给Daxia等差数列A(0),告诉Daxia首项a和公差d; 首先让Daxia求出数列A(0)前n项和,得 ...