mybatis 异常处理:Invalid bound statement (not found)
2016-08-11 17:10
381 查看
mybatis 的使用过程中提示错误:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.msunsoft.mapper.HisLisReportMapper.getMaxMtcData
含义:HisLisReportMapper的getMtcData方法没有找到或者没有绑定
背景:
1.HisLisReportSyncWorker 控制类中
HisLisReportServiceImpl
HisLisReportMapper 代码
HisLisReportService 代码
Mybatis.xml文件
错误处理流程:
我这里使用的SSM,spingMvc ,mybatis ,maven来构建项目,项目中使用了HisLisReportSyncWorker的控制类,HisLisReportServiceImpl代码实现,HisLisReportService接口类,HisLisReportMapper 的mapper类以及HisLisReportMapper.xml配置文件
1.检查实现类中方法是否存在
2。检查Service类的这个方法是否存在
3.检查Mapper类的这个方法
4.对应的mybatis 的配置文件是否存在,里面数据是否配置正确
5.检查Mapper类是否被加载了
这个错误主要是因为在config的配置文件中没有加载这个xml文件
`
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文件
`
<mapper resource="mybatis/HisLisReportMapper.xml" /> </mappers>`
相关文章推荐
- mybatis 异常处理:Invalid bound statement (not found)
- mybatis 异常处理:Invalid bound statement (not found)
- Mybatis异常:Invalid bound statement (not found)
- Mybatis异常_01_Invalid bound statement (not found)
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)异常处理办法
- Mybatis异常_03_Invalid bound statement (not found)
- mybatis异常:Invalid bound statement (not found)
- mybatis 异常:Invalid bound statement (not found) .
- mybatis错误Invalid bound statement (not found) 的解决办法
- mybatis3: Invalid bound statement (not found)
- mybatis一个怪异的问题: Invalid bound statement (not found)
- mybatis:Invalid bound statement (not found)
- mybatis使用时org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):的错误
- Mybatis - 在idea中错误:Invalid bound statement (not found)
- 关于mybatis “org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)” 错误的问题。
- Maven 遇到mybatis 发生org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- 再说mybatis3:Invalid bound statement (not found)
- mybatis使用bug:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
- IntelliJ IDEA使用Maven创建Spring和Mybatis工程出现...BindingException: Invalid bound statement (not found)
- MyBatis典型的错误org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)