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 ...
随机推荐
- MySQL基础篇(02):从五个维度出发,审视表结构设计
本文源码:GitHub·点这里 || GitEE·点这里 一.数据场景 1.表结构简介 任何工具类的东西都是为了解决某个场景下的问题,比如Redis缓存系统热点数据,ClickHouse解决海量数据的 ...
- Spring boot2.0学习笔记(一)
学习环境: jdk1.8 (Spring Boot 推荐jdk1.8及以上): java version "1.8.0_241" Maven 3.x (maven 3.2 以上版本 ...
- 纪中20日c组T2 2122. 【2016-12-31普及组模拟】幸运票
2122. 幸运票 (File IO): input:tickets.in output:tickets.out 时间限制: 1000 ms 空间限制: 262144 KB 具体限制 Goto P ...
- 吴裕雄--天生自然HADOOP操作实验学习笔记:mapreduce代码编程
实验目的 深入了解mapreduce的底层 了解IDEA的使用 学会通过本地和集群环境提交程序 实验原理 1.回忆mapreduce模型 前面进行了很多基础工作,本次实验是使用mapreduce的AP ...
- Vue自定义全局Toast和Loading
如果我们的Vue项目中没有用到任何UI框架的话,为了更好的用户体验,肯定会用到loading和toast.那么我们就自定义这两个组件吧. 1.Toast组件 首先,在common下新建global文件 ...
- grid 布局(2)
目录 grid 布局(2) grid区域属性 网格线名称 grid-template-areas 属性 grid-auto-flow 容器内子元素的属性 grid 布局(2) grid区域属性 网格线 ...
- 判定PDF文件是否能够正常打开
下载iTextSharp.dll using iTextSharp.text.pdf; PdfReader reader = new PdfReader(strPath + "\\" ...
- java在子类中,调用父类中被覆盖的方法
在java中,子类中调用与父类同名的方法(即父类中被覆盖的方法)用super来调用即可,下面是示例: 子类父类的定义 public class b { void show() { System.out ...
- STL版本
STL - Standard Template Library , 是C++标准里面规定的模板库接口规范,但它只是接口规范,没有规定具体怎么实现. STL是C++标准的一部分,所以每个C++编译器都会 ...
- cmdb实现三种方式
为什么要做CMDB? 1.实现运维自动化,CMDB是实现运维自动化的基石 2.之前做资产统计的时候,使用execl来统计,为了年底资产审计方便 3.运维日常工作繁琐, 4.运行环境不统一 Agent方 ...