问题描述

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. 有关使用phpstudy搭建sqli-lab环境搭建时发生Uncaught Error: Call to undefined function mysql_connect()错误

    文章更新于2020-1-30 问题描述 Uncaught Error: Call to undefined function mysql_connect() 分析 经查php手册可知 mysql_co ...

  2. navicate 连接mysql8.0,个人踩坑问题汇总

    navicate 连接mysql8.0,个人踩坑问题汇总本文目录:1:安装mysql8.0新增全新验证方式,安装如果不修改mysql连接不上2:mysql启动命令问题3:navicate 运程连接My ...

  3. Windows配置winpcap

    参考: https://blog.csdn.net/qq_29350467/article/details/46663953?depth_1-utm_source=distribute.pc_rele ...

  4. Magento2 观察者模式 之 插件

    etc/di.xml 定义如下: <type name="Magento\Quote\Model\Quote\Item\ToOrderItem"> <plugin ...

  5. git文件冲突合并的报错:Your local changes to the following files would be overwritten by merge

    记录一下在项目里使用git遇到代码冲突时的解决方法 问题:当我和我同事两个人改了相同的一个文件,他在我提交前提交了,这时候我就提交不了了,并且也pull不下来他的代码 会报错: Your local ...

  6. Unsupervise-learning-notes

    K-means 数据是没有label的,按照数据之间的相似性进行分类 原理and步骤 是随机选取K个对象作为初始的聚类中心, 计算每个对象与各个种子聚类中心之间的距离,把每个对象分配给距离它最近的聚类 ...

  7. python三器

    1.1 装饰器 1.装饰器的作用 1. 装饰器作用:本质是函数(装饰其他函数)就是为其他函数添加其他功能 2. 装饰器必须准寻得原则: 1)不能修改被装饰函数的源代码 2)不能修改被装饰函数的调用方式 ...

  8. H5-设置全屏背景图片样式

    .bgimg{ width: 100%; height: 95vh; margin: 0; padding: 0 .32rem; background-image: url('../image/ld. ...

  9. Android View框架的draw机制

    概述 Android中View框架的工作机制中,主要有三个过程: 1.View树的测量(measure) Android View框架的measure机制 2.View树的布局(layout)Andr ...

  10. 使用Beautiful Soup爬取猫眼TOP100的电影信息

    使用Beautiful Soup爬取猫眼TOP100的电影信息,将排名.图片.电影名称.演员.时间.评分等信息,提取的结果以文件形式保存下来. import time import json impo ...