org.hibernate.StaleStateException

There is a catch around the code to handle all exception, but the log shows we didn’t catch it. According to the first blog, it is not possible to catch such exception.

Advertisements

Exception in Hibernate ‘Cannot Release Connection’?

Note: The solution is under testing.

Add these config into the jpa file:
setup.dataSource.testOnBorrow = false
setup.dataSource.testOnReturn = false
setup.dataSource.testWhileIdle = true
setup.dataSource.validationQuery= Select 1
setup.dataSource.timeBetweenEvictionRunsMillis = 1800000

Reference: