简体   繁体   中英

java.sql.SQLException: Invalid column index in wildfly

I upgraded jboss 7 to wildfly 10 but there is a strange error which I couldn't understand why

The exception:

Caused by: java.sql.SQLException: Invalid column index at oracle.jdbc.driver.OraclePreparedStatement.setLongInternal(OraclePreparedStatement.java:4901) at oracle.jdbc.driver.OraclePreparedStatement.setLong(OraclePreparedStatement.java:4888) at oracle.jdbc.driver.OraclePreparedStatementWrapper.setLong(OraclePreparedStatementWrapper.java:206) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setLong(NewProxyPreparedStatement.java:703) at org.hibernate.type.descriptor.sql.BigIntTypeDescriptor$1.doBind(BigIntTypeDescriptor.java:46) at org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:73) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:257) at org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:252) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrateId(AbstractEntityPersister.java:2636) at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersiste r.java:2604) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2883)

It looks like hibernate is trying to convert datatype as wildfly is using newer version of hibernate

Generated sql which works fine when I run directly on oracle:

Error in processing CreateProvisiningBaseServiceImpl: org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access: SQLException for SQL [insert into NE_NOTIFICATION_INPUT (CREATION_DATE, FILE_NAME, INPUT_TYPE, INPUT_ID) values (?, ?, 'NotificationInput', ?)]; SQL state [99999]; error code [17003]; could not insert: [com.ericsson.enk.ne.db.model.NotificationInput]; nested exception is org.hibernate.exception.GenericJDBCException: could not insert: [com.ericsson.enk.ne.db.model.NotificationInput]

There is also something weird. When I remove the table, the error doesnt change. But when I remove the sequence, the error changes and says it cannot find sequence.

Java code for sequence is below:

 @Id @Column(name = "INPUT_ID", nullable = false) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "inputSequence") @SequenceGenerator(name = "inputSequence", sequenceName = "SEQ_INPUT_ID", allocationSize = 1) public long getInputId() { return inputId; } 

I narrowed down problem to JPA. It looks like problem is related to JPA upgrade from 2.0 to 2.1. As it is stated in question below, Discriminator mapping should be updated with "insertable = false, updatable = false" annotation Error when trying to insert an extended entity: invalid column index

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM