java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!
问题描述
java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!
红色部分报错
for (int i = 0; i < listParam.size(); i++) {
query.setParameter(i, listParam.get(i));
}
原因
需要的查询参数数量和实际赋值的数量不一致,例如我在sql语句中只有3个“?”,在for循环中却要赋值4次
实际案例
sql.append(" AND DEV.S_CAPTION LIKE '%?%' ");
将SQL语句中'中的?没有解析成占位符,解析成字符串了
个人随笔,如有错误,敬请指正
java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!的更多相关文章
- Spring的java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!异常处理方法
使用Spring提供的模板类HibernateDaoSupport,如果单纯的使用'命名参数'的形式编写HQL语句如: public class UserDaoImpl extends Hiberna ...
- java.lang.IndexOutOfBoundsException at java.io.FileOutputStream.writeBytes(Native Method)
ss available : /usr/linkapp/data/linkapp/ddn_1440639847758_temp java.lang.IndexOutOfBoundsException ...
- hive脚本出现Error: java.lang.RuntimeException: Error in configuring object和Caused by: java.lang.IndexOutOfBoundsException: Index: 9, Size: 9
是在reduce阶段报的错误,详细错误信息是 朱传豪 19:04:48 Diagnostic Messages for this Task: Error: java.lang.RuntimeExcep ...
- 滑动RecyclerView时出现异常: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 6(offset:6).state:30
RecyclerView 存在的一个明显的 bug 一直没有修复: java.lang.IndexOutOfBoundsException: Inconsistency detected. Inval ...
- listview 遇到问题java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
开发的时候 遇到 java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 这个异常有时候会有,有时候正常 不太好捕捉 猜测 已经 ...
- mybatis 插入 含有美元符号($) 字符串 报 java.lang.IndexOutOfBoundsException: No group 2 的问题
一:问题描述: 在springboot-security框架生成BCryptPasswordEncoder()方法生成加密后的密码后,带有$符号,导致新增用户的时候插入不了,报(IndexOutOfB ...
- maven发布到tomcat报错: Publishing failed Could not publish to the server. java.lang.IndexOutOfBoundsException
eclipse中将maven项目发布到tomcat报错时: Publishing failed Could not publish to the server. java.lang.IndexOutO ...
- Android中RecyclerView出现java.lang.IndexOutOfBoundsException
在RecyclerView更细数据时出现java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder ...
- IDEA报错Error:Module 'shop-common' production: java.lang.IndexOutOfBoundsException
问题描述: 本来项目是正常的,编译.运行.启动都是OK的,但是在一次电脑重启后,出现了以上这个问题:Error:Module 'shop-common' production: java.lang.I ...
随机推荐
- P3902 递增
链接:P3902 ----------------------------------------- 这道题就是最长上升子序列的模板题,因为我们修改的时候可没说不能改成小数(暴力) --------- ...
- grid 布局(2)
目录 grid 布局(2) grid区域属性 网格线名称 grid-template-areas 属性 grid-auto-flow 容器内子元素的属性 grid 布局(2) grid区域属性 网格线 ...
- 在oracle中使用merge into实现更新和插入数据
目录 oracle中使用merge into DUAL表解释 使用场景 用法 单表 多表 oracle中使用merge into DUAL表解释 在Oracle数据库中,dual是Oracle中的一个 ...
- python3-cookbook笔记:第二章 字符串和文本
python3-cookbook中每个小节以问题.解决方案和讨论三个部分探讨了Python3在某类问题中的最优解决方式,或者说是探讨Python3本身的数据结构.函数.类等特性在某类问题上如何更好地使 ...
- 树莓派pip安装opencv报错,Could not find a version that satisfies the requirement cv2 (from versions: )No matching distribution found for cv2
前言 我在使用pip install opencv-python 时报错 Could not find a version that satisfies the requirement opencv ...
- linux命令su,sudo 使用和区别
1- sudo 与 su 两个命令的最大区别是: sudo 命令需要输入当前用户的密码,su 命令需要输入 root 用户的密码.另外一个区别是其默认行为.sudo 命令只允许使用提升的权限运行单个命 ...
- python笔记09
今日内容 三元运算 函数 内容详细 三元运算(三目运算) v = 前面 if 条件 else 后面 if 条件: v = '前面' else: v = '后面' # 让用户输入值,如果值是整数,则转换 ...
- 开学第一课Java考试
package moguiba;import java.text.DecimalFormat;import java.util.Scanner;import moguiba.ScoreInformat ...
- vue 问题总结
1. 动态设置图片, <img :src="url"> data() { return { url: require(相对路径) // 直接写相对路径会出错 } } 2 ...
- sqlserver创建和删除外键约束
x先找出约束名字然后删除它我给个例子 --测试环境--主表create table test1(id int primary key not null,value int)insert test1 s ...