mybatis:Could not set parameters for mapping: ParameterMapping
报错:
展开查看
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='name', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
### The error may exist in com/kuaicode/dao/WorkerMapper.java (best guess)
### The error may involve com.kuaicode.dao.WorkerMapper.selectWorkersByName-Inline
### The error occurred while setting parameters
### SQL: select * from tb_worker where name like concat('%', '?', '%')
### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='name', mode=IN, javaType=class java.lang.String, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #1 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
**SQL语句:**
select * from tb_worker where name like concat('%', '#{name}', '%');
解决办法:
去除参数的单引号。
总结:
比较蠢的错误且找了很长时间。
mybatis:Could not set parameters for mapping: ParameterMapping的更多相关文章
- 【异常及源码分析】org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping
一.异常出现的场景 1)异常出现的SQL @Select("SELECT\n" + " id,discount_type ,min_charge, ${cardFee} ...
- Mybatis 模糊查询 like【笔记】Could not set parameters for mapping
当使用mybatis 做模糊查询时如果这样写 会报 Could not set parameters for mapping: ParameterMapping{property='keywords' ...
- Mybatis:使用bean传值,当传入值为Null时,提示“无效的列类型”的解决办法
问题描述:在使用mybatis对数据库执行更新操作时,parameterType为某个具体的bean,而bean中传入的参数为null时,抛出异常如下:org.mybatis.spring.MyBat ...
- 出现: object() takes no parameters 之后应该如何修改
这个错误花费了很多的时间去解决,包括重写代码也无济于事. 因为粗心,浪费了很多的时间在这个上面,特写此博客来记录,也希望朋友们不要粗心,特别是初学者. 接下来进入正文: 当在写self.XXX 下方 ...
- mybatis:SQL拦截器
打印执行的SQL语句 import java.sql.Connection; import java.text.DateFormat; import java.util.Date; import ja ...
- 深入浅出MyBatis:JDBC和MyBatis介绍
JDBC相关概念 Java程序都是通过JDBC连接数据库的,通过SQL对数据库编程,JDBC是由SUN公司提出的一些列规范,只定义了接口规范,具体实现由各个数据库厂商去实现,它是一种典型的桥接模式. ...
- Mybatis:Reader entry: ���� 4
Mybatis:Reader entry: ���� 4 现象: 产生原因:mybatis-config.xml里面配置了包的别名引发的 处理过程:注释掉 结果:就没有乱码了
- Mybatis 自动从数据库生成entity,mapping,dao接口
1.下载需要的jar包 mybatis-generator-core-1.3.2.jar,mysql-connector-java-5.1.39.jar 2.把上面的jar包放到某个目录,并在该目录下 ...
- MyBatis:二级缓存原理分析
MyBatis从入门到放弃七:二级缓存原理分析 前言 说起mybatis的一级缓存和二级缓存我特意问了几个身边的朋友他们平时会不会用,结果没有一个人平时业务场景中用. 好吧,那我暂且用来学习源码吧.一 ...
- mybatis:自动分页插件
项目地址:https://github.com/pagehelper/pagehelper-spring-boot 简单使用: 1.在pom文件中添加 <dependency> <g ...
随机推荐
- 用JS实现一个简单的购物车小案例
该案例主要是实现的功能有:添加商品功能,将商品添加到购物车的功能还有将商品删除功能,还有就是移出购物车的功能 该案例实现的难点是将商品添加到购物车列表的时候 数量的增加,当购物车有该商品的时候就进行累 ...
- pip下载时使用国内镜像 设置pip.ini文件
https://blog.csdn.net/u011107575/article/details/109901086 https://www.python.org/ftp/python/https:/ ...
- scroll-view 横向滚动无效
scroll-view的内层view元素需要: display: inline-block scroll-view的外层元素需要: white-space: nowrap 使得内部组件不换行.
- android系统上编写、运行C#代码
最近找到个好玩的APP,C#Shell (Compiler REPL),可以在安卓系统上编写和运行C#代码,配合sqlite数据库,写了个小爬虫,运行还不错: 运行一些小爬虫或者定时任务可以用这个,毕 ...
- matlab解析毫米波雷达bin文件数据 得到复数
来源:TI提供的Mmwave Radar Device ADC Raw Data Capture %%% This script is used to read the binary file pro ...
- wrangler 13 mwz 脱浆记录
100度水泡了1个小时,一点没缩 70度水泡了3个小时,一点没缩 随后绝望,放洗衣机里洗了20min,缩了2cm 想再接再厉,放洗衣机30min,没缩 放外面晾干,看晾干以后多长吧 --------- ...
- python-实现栈结构
# encoding=utf-8 class Stack(object): """栈""" def __init__(self): &quo ...
- Rust for Rustaceans: Idomatic Programming for Experienced Developers Chap.2 Types
翻译的内容如果有不理解的地方或者是其他的差错,欢迎后台回复讨论. 类型在内存中的表示 Rust中的每一个值都有自己的类型(Type).在这一章中,我们将会看到Rust中的类型服务于许多不同的目的,但其 ...
- webpack之webpack和vite的区别
打包原理 缺点 其他特点 webpack 解析各个模块的依赖关系 使用loader转换文件,使用plugin注入钩子,打包合并模块,最终生成bundle文件,使用express开启本地服务器, 浏 ...
- 三天吃透RabbitMQ面试八股文
本文已经收录到Github仓库,该仓库包含计算机基础.Java基础.多线程.JVM.数据库.Redis.Spring.Mybatis.SpringMVC.SpringBoot.分布式.微服务.设计模式 ...