java~springboot~ibatis Invalid bound statement (not found)原因
事实起因
最近在ORM上使用了ibatis,感觉挺繁琐的,没有jpa来的直接,但项目非要用也没有办法,最近在进行开发过程中出现了一个问题Invalid bound statement (not found)意思是说,你的xml映射和你的mapper方法不一致,这种不一致大叔总结几点,如果你出现了这种问题可以按着下面几后进行排查。
可能出现的原因
- xml输入参数类型不匹配,你可以改成
parameterType="map"试试 - xml返回参数类型问题,resultType="你的类型",不要写成resultMap="你的类型"
- 返回的DTO与返回结果集名称不匹配,这时你要对照类型的属性,去为sql设置别名
- 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)原因的更多相关文章
- springboot项目Invalid bound statement (not found): com.xxxx.dao.xxxDAO.xxx解决方法
1.首先判断自己的Dao和mapper的对应关系,注意要一一对应的. 2.配置信息出现问题,注意配置信息填写: 3.记住要细心细心,细心,重要的事情说三遍.
- 访问mapper方法提示invalid bound statement (not found)原因总结
1.访问所有的mapper都报此错误,检查 mapper.xml 中的 namespace 2.访问mapper中的部分方法时报此错误,检查xml文件中的id是否和接口中的方法名一致 3.mapper ...
- 完美解决: org.apache.ibatis.binding.BindingException Invalid bound statement (not found)
异常描述: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) 原因: springboot ...
- 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 ...
- maven项目:Invalid bound statement
在使用maven做mybatis项目时会遇到这个问题, org.apache.ibatis.binding.BindingException: Invalid bound statement (not ...
- 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 ...
- 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 ...
- 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 ...
- 【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) 需要检查的步骤: ...
随机推荐
- linux相关命令及配置(四)
Linux第四章课堂笔记一.RPM包管理命令 1.RPM包是本地文件,存在于本地文件中 2.使用RPM命令管理.rpm包 3.挂载光驱 # mount /dev/cdrom /media/ 查看:rp ...
- authorizations.go
{ return nil, fmt.Errorf("invalid TTL %d (must be >0)", authState.TTL) } ...
- C++中memset()函数的作用
memset()函数可以对大内存的分配进行很方便的操作(初始化),所谓“初始化”,当然是指将你定义的变量或申请的空间赋予你所期望的值, 例如语句int i=0;就表明定义了一个变量i,并初始化为0: ...
- 电梯调度设计之初感想——蔡迎盈&&曹玉松
突然拿到这个问题,蒙了好久,索性走一步,再走一步好了,希望在这天下第一庄里,会看到晴空. 查了好多资料,终于还是整理出一个很草稿的版本,这只能算是我们初步的设计. 四部电梯载重和乘客限制不同, ...
- java 判断是否为中文字符,部分,。中文符号不能识别
public static void main(String[] args) { int i = 0; for (char c : ",.判断一个字符串是否有中文一般情况是利用Unicode ...
- Android 8.1 源码_启动篇(一) -- 深入研究 init(转 Android 9.0 分析)
前言 init进程,它是一个由内核启动的用户级进程,当Linux内核启动之后,运行的第一个进程是init,这个进程是一个守护进程,确切的说,它是Linux系统中用户控件的第一个进程,所以它的进程号是1 ...
- 第一章.java&golang的区别之:闭包
对于golang一直存有觊觎之心,但一直苦于没有下定决心去学习研究,最近开始接触golang.就我个人来说,学习golang的原动力是因为想要站在java语言之外来审视java和其它语言的区别,再就是 ...
- 通过模拟JDK中的动态代理,由浅入深讲解动态代理思想.
目录 场景引入 动态代理引入 动态代理进阶 总结 个人认为动态代理在设计模式中算是比较难的, 本篇文章将从无到有, 从一个简单代码示例开始迭代, 逐步深入讲解动态代理思想. 场景引入 假设现在有一个坦 ...
- 面试前必须要知道的Redis面试题
前言 只有光头才能变强. 文本已收录至我的GitHub仓库,欢迎Star:https://github.com/ZhongFuCheng3y/3y 回顾前面: 从零单排学Redis[青铜] 从零单排学 ...
- javascript入门篇(五)
将日期转换为数字 全局方法 Number() 可将日期转换为数字 d = new Date(); Number(d) // 返回 1404568027739 日期方法 getTime ...