What events cause "org.springframework.transaction.TransactionSystemException - Could not roll back JPA transaction; nested exception is javax.persistence.PersistenceException: unexpected error when rollbacking" exceptions?
-
1You should try to provide more information on what you are trying to do, at what point you get the error, etc. Perhaps a full stack trace and some code/config files would help too...– Tim BDec 12, 2013 at 23:32
2 Answers
I got the same error with spring and Jpa.
The problem was with disconnection to Mysql database in case of timeout. I didn't use application during the night and in the morning I got the same error. When you inactive, spring do nothing and it get timeout.
To prevent it you can add into application.properties
next lines:
spring.datasource.connection-test-query="SELECT 1"
spring.datasource.test-while-idle=true
spring.datasource.test-on-borrow=true
Now it works fine. Also additional info from Virtustilus blog can be useful.
If the transaction is a XA-Transaction (distributed) then one of the participants might have rejected the rollback.