问题描述

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!的更多相关文章

  1. Spring的java.lang.IndexOutOfBoundsException: Remember that ordinal parameters are 1-based!异常处理方法

    使用Spring提供的模板类HibernateDaoSupport,如果单纯的使用'命名参数'的形式编写HQL语句如: public class UserDaoImpl extends Hiberna ...

  2. java.lang.IndexOutOfBoundsException at java.io.FileOutputStream.writeBytes(Native Method)

    ss available : /usr/linkapp/data/linkapp/ddn_1440639847758_temp java.lang.IndexOutOfBoundsException ...

  3. 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 ...

  4. 滑动RecyclerView时出现异常: java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 6(offset:6).state:30

    RecyclerView 存在的一个明显的 bug 一直没有修复: java.lang.IndexOutOfBoundsException: Inconsistency detected. Inval ...

  5. listview 遇到问题java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0

    开发的时候 遇到 java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 这个异常有时候会有,有时候正常 不太好捕捉 猜测 已经 ...

  6. mybatis 插入 含有美元符号($) 字符串 报 java.lang.IndexOutOfBoundsException: No group 2 的问题

    一:问题描述: 在springboot-security框架生成BCryptPasswordEncoder()方法生成加密后的密码后,带有$符号,导致新增用户的时候插入不了,报(IndexOutOfB ...

  7. 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 ...

  8. Android中RecyclerView出现java.lang.IndexOutOfBoundsException

    在RecyclerView更细数据时出现java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder ...

  9. IDEA报错Error:Module 'shop-common' production: java.lang.IndexOutOfBoundsException

    问题描述: 本来项目是正常的,编译.运行.启动都是OK的,但是在一次电脑重启后,出现了以上这个问题:Error:Module 'shop-common' production: java.lang.I ...

随机推荐

  1. ORACLE10G非归档模式下RMAN异机迁库

    环境信息: 源库 目标库 操作系统 WIN7 WIN SVR 2012 R2 IP x.x.x.216 x.x.x.112 数据库版本 10.2.0.4.0 - 64bi 10.2.0.4.0 - 6 ...

  2. SpringBoot 教程之 profile 的应用

    目录   区分环境的配置  区分环境的代码  激活 profile  示例源码  参考资料 一个应用为了在不同的环境下工作,常常会有不同的配置,代码逻辑处理.Spring Boot 对此提供了简便的支 ...

  3. 安装Kubernetes到CentOS(Minikube)

    运行环境 系统版本:CentOS Linux release 7.6.1810 (Core) 软件版本:Docker-ce-18.06.0.Kubectl-1.15.0.Kubernetes-v1.1 ...

  4. P2055 [ZJOI2009]假期的宿舍【二分图/最大流】

    题目描述 学校放假了 · · · · · · 有些同学回家了,而有些同学则有以前的好朋友来探访,那么住宿就是一个问题. 比如 A 和 B 都是学校的学生,A 要回家,而 C 来看B,C 与 A 不认识 ...

  5. PTA 1005 Spell It Right

    题目描述: Given a non-negative integer N, your task is to compute the sum of all the digits of N, and ou ...

  6. jquery.datetimepicker中报错Cannot read property 'top' of undefined

    今天在项目里用到一个jQuery的时间插件,一开始自己写的测试demo完全么的问题 但当我把它放到项目里时问题来了,报了一个错:Cannot read property 'top' of undefi ...

  7. dubbox的小案例

    什么是Dubbox: Dubbo是一个被国内很多互联网公司广泛使用的开源分布式服务框架,即使从国际视野来看应该也是一个非常全面的SOA基础框架.作为一个重要的技术研究课题,在当当网根据自身的需求,为D ...

  8. Prometheus的查询语法是PromQL基本语法

    PromQL(Prometheus Query Language)是 Prometheus 自己开发的表达式语言,语言表现力很丰富,内置函数也很多.使用它可以对时序数据进行筛选和聚合. 1- Prom ...

  9. CF895C Square Subsets [线性基]

    线性基的题- 考虑平方数只和拆解质因子的个数的奇偶性有关系 比如说你 \(4\) 和 \(16\) 的贡献都是一样的.因为 \(4 = 2^2 , 16 = 2^4\) \(2\) 和 \(4\) 奇 ...

  10. Centos7 修改/etc/profile错误后导致所有命令“not found”

    因为Centos7中运行着两个版本的php,今天在设置环境变量时导致所有命令都 "not found". 修复方式: 第一:执行 /bin/vi /etc/profile 把文件修 ...