简体   繁体   English

Spring Hibernate SessionUtils connection.close

[英]Spring Hibernate SessionUtils connection.close

Question regarding following code 有关以下代码的问题

SessionFactoryUtils.getDataSource(getSessionFactory()).getConnection()

Does connection checked out from above line of code required to be closed upon method finished work? 方法完成后,是否需要从上述代码行中检出连接是否关闭?

The real answer depends on how you're using it. 真正的答案取决于您的使用方式。 The intent is that this can be called multiple times within a transaction, and if you're using it this way then you definitely would not want to close it. 目的是可以在一个事务中多次调用它,并且如果您以这种方式使用它,那么您肯定不想关闭它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM