Closed
Description
Whereas EntityManagerFactoryUtils.closeEntityManager()
will check if EntityManager is open before trying to close it, SessionFactoryUtils.closeSession()
doesn't check if session is open.
As a consequence, if EntityManager is closed when entering closeEntityManager()
, nothing will happen,
whereas if Session is closed when entering closeSession()
, a log ERROR will be generated (because of "org.hibernate.SessionException: Session was already closed") (tested with Spring 5.2 + Hibernate 5.1).
Maybe we could have a common behaviour between both classes ?
See related commit for EntityManagerFactoryUtils : 928f542
Context :
- module spring-orm
- class
org.springframework.orm.jpa.EntityManagerFactoryUtils
- class
org.springframework.orm.hibernate5.SessionFactoryUtils
- class