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文件配置的形式, 而且坑爹的是题主的两个文件的路径写的也不一 ...
随机推荐
- 介绍一款网站前台图片滚动插件之"switchable"
一.简单介绍:jQuery.Switchable是一款整合了Tabs.Slide.Scrollable等常见UI组件的jQuery插件,在这里,简答说说他的Slide.像Tabs,在Jquery-UI ...
- 关于vs2012解决方案中项目DLL文件引用问题
今天用vs2012建了项目框架,老是出现说解决方案中的项目dll文件不存在,但是我按照路径去找是可以找到这个文件的,也就是说这个文件存在的.我按照引用顺序单个编译每个项目都是成功的,就是当我编译整个解 ...
- 微信JSApi支付---常见问题
1.支付一直报 “get_brand_wcpay_request:false” 错误 原因: 商户平台上设置的[支付授权目录]路劲不正确,比如:支付的页面的域名是:www.xxx.com/pay/s ...
- 60个DevOps开源工具,你在用哪些?
你喜欢免费的东西吗?获得开发者社区支持的自动化,开源的工具是大家梦寐以求的.这里列举了 60 多款最棒的开源工具,可以帮助你很好的实行 DevOps. 一.开发工具 版本控制&协作开发 1.版 ...
- STP-19-Port-Channel发现和配置
工程师在给一台交换机上的特定Port-Channel增加多个端口时,有一些配置参数必须相同,如下所示: 使用相同的速率和双工设置: 使用相同的操作模式(Trunk.Access.动态): 若不为T ...
- CF C. Plasticine zebra (思维)
题意: 是输入一个只有'w','b'的字符串,可以对他的任意位置切割成两个子串,切割后的右边的子串翻转后再和左边的子串拼起来会得到一个新的字符串,操作次数不限,问能得到的字符串中wb交替出现的最大的长 ...
- Jenkins之自动触发部署之插件Generic Webhook Trigger Plugin
一.安装好插件 二.构建触发器会出现设置trigger的入口 三.设置的两个部分 第一: Jenkins的这个触发器,这里主要是接受post数据.其中Post content parameters是用 ...
- Sandcastle Help File Builder 生成NET帮助文档
Sandcastle是微软提供的一个根据XML注释和DLL文件生成帮助文件的工具,目前是在CodePlex上的一个开源项目,可以去这里下载:Sandcastle Sandcastle生成的输出结果具有 ...
- Angular 8 发布
原文地址:https://blog.angular.io/version-8-of-angular-smaller-bundles-cli-apis-and-alignment-with-the-ec ...
- Docker | 第一章:Docker简介
前言 作为本系列的起始章节,本章节主要是对Docker的相关概念进行简单阐述下.自此也是查阅了相关资料,奈何也都是英文版居多,看的是有点头大的.现在悔不当初不好好学习英文了.o(︶︿︶)o 唉 Doc ...