spring-projects / spring-projects/spring-framework
HibernateTransactionManager 'running within' exception message can be misleading [SPR-9496]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
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
DataSourceTransactionManagerin the text.
Affects: 3.1 GA
4 votes, 7 watchers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at HibernateTransactionManager.doBegin(), where the reported IllegalTransactionStateException message is hard coded. Verify whether the message appears with enclosing transaction managers other than DataSourceTransactionManager, then confirm completion by using wording that does not name that manager type.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100