-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Reto Urfer opened SPR-9020 and commented
The Hibernate4 support of Spring 3.1 does not open and register a session in case of the method called is annotated with @Transactional(propagation = Propagation.SUPPORTS).
In this case HibernateTransactionManager.doBegin() is never called which is the only place where hibernate session is opened. The result is, that all read operations which do not require a transaction will fail because the call to SessionFactory.currentSession() will result in an exception.
The Hibernate3 implementation contains a fallback for this case in SessionFactoryUtils.doGetSession(...) which is missing in the corresponding Hibernate4 implementation of SpringSessionContext.currentSession().
If the transaction propagation is changed to REQUIRES_NEW everything is working fine.
Affects: 3.1 GA
Issue Links:
- Hibernate4 version of SpringSessionContext.currentSession() does not create a session if TransactionSynchronizationManager does not contain one [SPR-11801] #16421 Hibernate4 version of SpringSessionContext.currentSession() does not create a session if TransactionSynchronizationManager does not contain one ("is duplicated by")
- org.springframework.orm.hibernate4.HibernateTransactionManager fails with NoSuchMethodError against SessionFactory.getCurrentSession() [SPR-8908] #13548 org.springframework.orm.hibernate4.HibernateTransactionManager fails with NoSuchMethodError against SessionFactory.getCurrentSession()
- H4 SpringSessionSynchronization#beforeCompletion leaves irreparably broken state if exception thrown in session.disconnect() [SPR-13089] #17680 H4 SpringSessionSynchronization#beforeCompletion leaves irreparably broken state if exception thrown in session.disconnect()
- HibernateTransactionManager should allow holdability of ResultSet into the View layer [SPR-12349] #16954 HibernateTransactionManager should allow holdability of ResultSet into the View layer
19 votes, 28 watchers