问题
When trying to update an Entity in Hibernate Im getting this ERROR:
SEVERE: Could not synchronize database state with session
So the request is not being saved to database. My entity has many-to-one relationship.
What should I do?
org.springframework.orm.hibernate3.HibernateJdbcException: JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.DataException: could not update: [org.game.model.HeroChampion#1234567]
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:634)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:695)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:566)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:540)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:510)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:310)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:117)
JDBC exception on Hibernate data access; nested exception is org.hibernate.exception.DataException: could not update:
Do I need to perform a session.refresh as stated in this post?
来源:https://stackoverflow.com/questions/60635336/severe-could-not-synchronize-database-state-with-session