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文件配置的形式, 而且坑爹的是题主的两个文件的路径写的也不一 ...
随机推荐
- Umbraco back office 中form显示不出来的问题
问题纠结了好久,没找到什么原因,具体就是在back office中,form显示不出来.如下: 按下F12,在chrome 的developer tools中发现如下错误 找了半天不知道原因,后来看到 ...
- 【转】log4j.properties 详解与配置步骤 - edward0830ly的专栏 - 博客频道 - CSDN.NET
一.log4j.properties 的使用详解 1.输出级别的种类 ERROR.WARN.INFO.DEBUGERROR 为严重错误 主要是程序的错误WARN 为一般警告,比如session丢失IN ...
- 网易 UI 自动化工具 Airtest 浅用记录
一 使用目的 该工具主要是面向游戏UI测试基于图像识别,如游戏框架unity,Cocos-js以及网易内部的游戏框架 同时也支持原生Android App 的基于元素识别的UI自动化测试. 本文主要使 ...
- 2017-10-6 清北刷题冲刺班a.m
1.角谷猜想 #include<iostream> #include<cstdio> #include<cstring> #define maxn 10010 us ...
- CircleCI 与持续集成
CircleCI 入门 最近在完成老师的作业:使用 CircleCI 进行持续集成,现将过程书写下来,与大家一起学习进步. A. What is CircleCI? 1. 什么是持续集成 持续集成(C ...
- 基础篇 - pg_isready
pg_isready 发起一个到指定 PostgreSQL数据库的连接检查. 使用方法: pg_isready [选项]... 选项: -d, --dbname=DBNAME 数据库名 -q, --q ...
- springBoot2.0 配置 mybatis+mybatisPlus+redis
一.Idea新建springBoot项目 next到完成,然后修改使用自己的maven 等待下载包 二.pom.xml文件 <?xml version="1.0" encod ...
- 洛谷P1318 积水面积
题目描述 一组正整数,分别表示由正方体叠起的柱子的高度.若某高度值为\(x\),表示由\(x\)个正立方的方块迭起(如下图,\(0<=x<=5000\)).找出所有可能积水的地方(图中蓝色 ...
- HTTP/TCP协议基础
HTTP协议 基本概念 HTTP协议(超文本传输协议 HyperText Transfer Protocol):是用于从WWW服务器传输超文本到本地浏览器的传送协议.它不仅保证计算机正确快速地传输超文 ...
- win下rabbitmq的安装
安装erlang 10.4 和 rabbitmq 3.7.5 然后关闭rabbitmq服务 然后设置 erlang和rabbitmq的环境变量 ERLANG_HOME=erlang安装目录 RABBI ...