我将jboss 7升级为wildfly 10,但有一个奇怪的错误,我无法理解为什么
例外:
引起:java.sql.SQLException:列索引无效 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) 在com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setLong(NewProxyPreparedStatement.java:703) 在org.hibernate.type.descriptor.sql.BigIntTypeDescriptor $ 1.doBind(BigIntTypeDescriptor.java:46) 在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) 在org.hibernate.persister.entity.AbstractEntityPersister.dehydrateId(AbstractEntityPersister.java:2636) 在org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2604) 在org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2883)
看起来hibernate试图转换数据类型,因为wildfly正在使用更新版本的hibernate
生成的sql在我直接在oracle上运行时工作正常:
处理CreateProvisiningBaseServiceImpl时出错:org.springframework.orm.hibernate3.HibernateJdbcException:Hibernate数据访问时的JDBC异常:SQL的SQLException [插入NE_NOTIFICATION_INPUT(CREATION_DATE,FILE_NAME,INPUT_TYPE,INPUT_ID)值(?,?,'NotificationInput') ,?)]; SQL状态[99999];错误代码[17003];无法插入:[com.ericsson.enk.ne.db.model.NotificationInput];嵌套异常是org.hibernate.exception.GenericJDBCException:无法插入:[com.ericsson.enk.ne.db.model.NotificationInput]
还有一些奇怪的东西。当我删除表时,错误不会改变。但是当我删除序列时,错误会改变并说它无法找到序列。
序列的Java代码如下:
@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; }
答案 0 :(得分:0)
我把问题缩小到了JPA。看起来问题与JPA从2.0升级到2.1有关。正如下面所述,Discriminator映射应更新为" insertable = false,updatable = false"注解 Error when trying to insert an extended entity: invalid column index