0
votes

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(AbstractEntityPersister.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;
}
1
Removed the sql-server tag - Aleksej
Show us your Java code and the SQL statement - a_horse_with_no_name
Why do you think an error message referring to 'invalid column index' is a data type problem? - Alex Poole
@AlexPoole, because it breaks at this line.oracle.jdbc.driver.OraclePreparedStatement.setLongInternal(OraclePreparedStatement.java:4901) - Olcay Tarazan
@a_horse_with_no_name, I can not show full java code due to restrictions but even when I remove the table, error remains. I suspect something wrong with the sequence definition - Olcay Tarazan

1 Answers

0
votes

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