What events cause "org.springframework.transaction.TransactionSystemException - Could not roll back JPA transaction; nested exception is javax.persistence.PersistenceException: unexpected error when rollbacking" exceptions?
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 you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With