我使用Spring 3.0.4-RELEASE,JPA 2.0与Hibernate作为提供程序,JTA JOTM用于我的应用程序中的事务。我已经在我的实体对象调用entityManager.merge
时收到以下错误:org.springframework.transaction.UnexpectedRollbackException for null @Version列
org.objectweb.jotm.SubCoordinator commit_one_phase
INFO: Rollback during beforeCompletion in SubCoordinator.commit_one_phase
org.springframework.transaction.UnexpectedRollbackException: JTA transaction unexpectedly rolled back (maybe due to a timeout); nested exception is javax.transaction.RollbackException
at
org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1012)
此错误之际,将数据直接写入数据库(MySQL的)通过我们的了Talend ETL作业的结果。我注意到我的数据库中的@Version
列有NULL
值,并决定将它们设置为0,这解决了问题。
为什么不能@Version
列是NULL
?有其他人遇到过这个问题吗?谢谢。