事实起因

最近在ORM上使用了ibatis,感觉挺繁琐的,没有jpa来的直接,但项目非要用也没有办法,最近在进行开发过程中出现了一个问题Invalid bound statement (not found)意思是说,你的xml映射和你的mapper方法不一致,这种不一致大叔总结几点,如果你出现了这种问题可以按着下面几后进行排查。

可能出现的原因

  1. xml输入参数类型不匹配,你可以改成parameterType="map"试试
  2. xml返回参数类型问题,resultType="你的类型",不要写成resultMap="你的类型"
  3. 返回的DTO与返回结果集名称不匹配,这时你要对照类型的属性,去为sql设置别名
  4. yml文件里对ibatis配置有问题

    如下面代码:
@Getter
@Setter
public class BusinessCustomerDTO {
private Long id;
private String customerName;
private String contactPerson;
private Integer freeDays;
private String city;
private String province;
private String source;
private LocalDateTime enterDays;
private String leadingPerson;
}

对应的mapper代码:

  <select id="getBusinessCustomers" parameterType="java.util.Map" resultType="cn.pilipa.customer.management.dto.BusinessCustomerDTO">
select a.id,
a.customer_name as customerName,
a.city_code as city,
a.province_code as province,
a.customer_source as source,
b.enter_storage_time as enterDays,
b.current_salesperson as leadingPerson,
c.contact_person as contactPerson from customer_base_info a
inner join customer_business_info b on a.id=b.customer_id
left join customer_contact_person c on c.customer_id=a.id
where c.is_main_contact=1
</select>

java~springboot~ibatis Invalid bound statement (not found)原因的更多相关文章

  1. springboot项目Invalid bound statement (not found): com.xxxx.dao.xxxDAO.xxx解决方法

    1.首先判断自己的Dao和mapper的对应关系,注意要一一对应的. 2.配置信息出现问题,注意配置信息填写: 3.记住要细心细心,细心,重要的事情说三遍.

  2. 访问mapper方法提示invalid bound statement (not found)原因总结

    1.访问所有的mapper都报此错误,检查 mapper.xml 中的 namespace 2.访问mapper中的部分方法时报此错误,检查xml文件中的id是否和接口中的方法名一致 3.mapper ...

  3. 完美解决: org.apache.ibatis.binding.BindingException Invalid bound statement (not found)

    异常描述: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 原因: springboot ...

  4. Exception:HTTP Status 500 - org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

    主要错误信息如下: HTTP Status 500 - org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...

  5. maven项目:Invalid bound statement

    在使用maven做mybatis项目时会遇到这个问题, org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...

  6. Java报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.sirifeng.babytun.dao.GoodsDAO.findById

    前言 最近学vue学得差不多了,想来搭个项目实战一下,结果刚开始搭建SSM框架的时候就来到了我们最喜欢的debug环节 org.apache.ibatis.binding.BindingExcepti ...

  7. org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.bw.mapper.BillMapper.getBillList at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225

    这个错误是没有找到映射文件 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.b ...

  8. java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.demoDao.getXXX;

    java.lang.RuntimeException: org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...

  9. 【mybatis】mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 或者 feign被调用方使用的mybatis总报空指针异常java.lang.NullPointerException,而变量都没有问题的情况

    mybatis访问报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 需要检查的步骤: ...

随机推荐

  1. compact_op.go

    package clientv3 import (     pb "github.com/coreos/etcd/etcdserver/etcdserverpb" ) // Com ...

  2. Windows上安装配置SSH教程(1)——知识点汇总

    1.是什么SSH? 维基百科:https://zh.wikipedia.org/wiki/Secure_Shell 其他博客:http://www.ruanyifeng.com/blog/2011/1 ...

  3. 用node探究http缓存

    用node搞web服务和直接用tomcat.Apache做服务器不太一样, 很多工作都需要自己做.缓存策略也要自己选择,虽然有像koa-static,express.static这些东西可以用来管理静 ...

  4. 浏览器插件使用socks5代理

    服务端测试,经常会遇到需要通过代理访问的情景,比如公司内网不能访问测试环境,这时可以通过socks5代理来解决. 一.使用Chrome浏览器访问   1. 下载并安装SwitchyOmega插件   ...

  5. 软件测试自动化的最新趋势对开源测试管理软件ITEST的启示

    https://www.infoq.cn/article/c-LHJS2ksuDxp1WkrGl4 理面提到几点,DevOps 的关键原则是开发团队.测试团队和运营团队协作,无缝发布软件.这意味着集中 ...

  6. 使用BeautifulSoup和正则表达式爬取时光网不同地区top100电影并使用Matplotlib对比

    还有一年多就要毕业了,不准备考研的我要着手准备找实习及工作了,所以一直没有更新. 因为Python是自学不久,发现很久不用的话以前学过的很多方法就忘了,今天打算使用简单的BeautifulSoup和一 ...

  7. c# 接口相同方法申明使用

    using System; namespace ConsoleApp1 { interface IInterface1 { void ft(); } interface IInterface2 { v ...

  8. 如何通过get,set方法访问到父类的私有属性

    刚学习继承的时候,总是会有这样的疑问. 子类继承父类时,会继承所有的非私有的属性和方法.那么在用set方法修改父类的私有属性时,怎么没有报空指针异常呢? 后来仔细想过这个问题,既然没有报空指针,那么在 ...

  9. 包装类及 LeetCode 每日一题

    1.包装类与创建对象 Java 为8大数据类型都提供了相应的包装类,并提供属性和方法,更方便的操作基本数据类型.包装类位于java.lang包中. 对于这几种类型的基本数据,都有相似的方法实现基本数据 ...

  10. 从On-Premise本地到On-Cloud云上运维的演进

    摘要: 从用户的声音中,我们听到用户对稳定.弹性.透明的诉求,我们也在不断升级ECS的运维能力和体验,助力用户建立主动运维体系,赋能业务永续运行.为了让大家更好的了解和用好ECS弹性计算服务,从本期开 ...