Open
Description
Sam Brannen opened SPR-9496 and commented
Status Quo
If you configure two instances of HibernateTransactionManager
(A and B) for different SessionFactory
instances (A and B) -- potentially using the same underlying DataSource
- and then a transactional method for A calls a transactional method for B, an IllegalTransactionStateException
is thrown with the following exception message (hard coded in HibernateTransactionManager.doBegin()
):
Pre-bound JDBC Connection found! HibernateTransactionManager does not support running within DataSourceTransactionManager if told to manage the DataSource itself. It is recommended to use a single HibernateTransactionManager for all transactions on a single DataSource, no matter whether Hibernate or JDBC access.
Granted the configuration described above may be the result of a configuration error, in any case the exception message can be misleading since the HibernateTransactionManager
might actually be running within a transaction manager that is not a DataSourceTransactionManager
.
Further Resources
Deliverables
- Verify that the exception message above is generated regardless of the type of the enclosing transaction manager.
- If the above verification is positive, modify the exception message so that it does not hard code
DataSourceTransactionManager
in the text.
Affects: 3.1 GA
4 votes, 7 watchers