Basics - Troubleshooting Hibernate / JDBC Connection Pool Issue

后端 未结 6 2084
Happy的楠姐
Happy的楠姐 2021-02-13 05:39

What is Hibernate\'s responsibility in regards to database connections it gets from an underlying connection pool. Does it test to see if a connection is closed before it uses i

6条回答
  •  一向
    一向 (楼主)
    2021-02-13 06:21

    I worked on an issue in the past where we weren't returning connections back to the pool correctly. So, when a connection was used and not returned, making a database call when it was timing out would throw an exception.

    We were able to reproduce the issue by making a call to the database, waited 8 hours (postgres' default time out) and tried to make a call to the database again. It throw the same exception every time. Our solution was to rethink (or better yet, add) a connection management strategy.

    So, to sum up, are you actually returning your connections to the pool by closing the Session?

提交回复
热议问题