DB2 / HIbernate:参数索引超出范围。错误代码= -4461,SQLSTATE = 42815

时间:2019-01-14 21:50:32

标签: java hibernate jboss spring-data-jpa db2

当试图将数据插入只有12列的表中时,会出现有关第13个参数的错误。 DUmped SQL不显示有第13个参数

我正在使用Spring data jpa将数据插入数据库。

X x = new X();

然后使用设置器设置12个参数。

异常结果:

insert into insert into X (A, B, C, D, E, F, G, H, I, J, K, L) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?): com.ibm.db2.jcc.am.SqlSyntaxErrorException: [jcc][10145][10844][4.19.26] Invalid parameter 13: Parameter index is out of range. ERRORCODE=-4461, SQLSTATE=42815
        at com.ibm.db2.jcc.am.kd.a(Unknown Source)
        at com.ibm.db2.jcc.am.kd.a(Unknown Source)
        at com.ibm.db2.jcc.am.kd.a(Unknown Source)
        at com.ibm.db2.jcc.am.gp.l(Unknown Source)
        at com.ibm.db2.jcc.am.gp.j(Unknown Source)
        at com.ibm.db2.jcc.am.gp.a(Unknown Source)
        at com.ibm.db2.jcc.am.gp.setString(Unknown Source)
        at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.setString(HikariProxyPreparedStatement.java)
        at org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$1.doBind(VarcharTypeDescriptor.java:57)
        at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:93)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:284)
        at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:279)
        at org.hibernate.type.ComponentType.nullSafeSet(ComponentType.java:343)
        at org.hibernate.persister.entity.AbstractEntityPersister.dehydrateId(AbstractEntityPersister.java:2835)
        at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2804)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3076)
        at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)
        at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)
        at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)
        at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)
        at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)
        at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349)
        at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)
        at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)
        at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)
        at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
        at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
        at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75)
        at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:518)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:292)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)


enter code here

0 个答案:

没有答案