我正在使用序列将域对象实例保存在我的 oracle 数据库中。我对数据库中的每个表都有一个序列。例如,当我在用户或资源上使用保存功能时,它在第一次尝试时创建了一个新资源,但使用的 ID 是 70?该序列显示了正确的下一个数字 - 42,因为表中的最大 id 为 41。为什么 id=70 用于插入新资源?
同样从下一次尝试所有插入都失败并出现此错误
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into GRARESOURCE (decomm
issioned, disabled, criticality, resourceClass, resourceGroupId, resourceName, ownerId, resourceSegmentId, resourceTypeId, riskSco
re, targetIP, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [GRA.SYS_C0012183]; nested exception is org.hibernate.e
xception.ConstraintViolationException: Could not execute JDBC batch update
不知道出了什么问题,因为这是在代码重组之后发生的......我们将代码移动到新包中......
编辑:我找到了原因,请参阅我的回复..谢谢大家