我有一个对象形式的类 x,我想通过 session.update() 更新它的属性,还有一个来自类 x 的对象列表,我想在同一事务中使用 query.executeUpdate() 更新其中的属性。提交事务服务器输出日志后显示此错误:
Caused by: org.hibernate.exception.GenericJDBCException: could not update: [com.net.models.hibernate.OrganizationStructure#1]
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:111)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3241)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:3090)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3491)
at org.hibernate.action.internal.EntityUpdateAction.execute(EntityUpdateAction.java:145)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:600)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:474)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39)
at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1437)
... 45 more
原因:java.sql.SQLException:无效的列类型:oracle.jdbc.driver.OraclePreparedStatement.setNullCritical(OraclePreparedStatement.java:4596) 的 oracle.jdbc.driver.OracleStatement.getInternalType(OracleStatement.java:3963) 的 16 .jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:4578) 在 oracle.jdbc.driver.OraclePreparedStatementWrapper.setNull(OraclePreparedStatementWrapper.java:1285) 在 com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.setNull(NewProxyPreparedStatement.java :462) 在 org.hibernate.type.AbstractStandardBasicType.nullSafeSet(AbstractStandardBasicType.java:280) 在 org.hibernate.type.AbstractStandardBasicType 的 org.hibernate.type.descriptor.sql.BasicBinder.bind(BasicBinder.java:61)。 nullSafeSet(AbstractStandardBasicType.java:275) 在 org.hibernate.type.AbstractSingleColumnStandardBasicType。nullSafeSet(AbstractSingleColumnStandardBasicType.java:39) 在 org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:2729) 在 org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:3168) ... 53更多的