Skip to content

HibernateTransactionManager 'running within' exception message can be misleading [SPR-9496] #14130

Open
@spring-projects-issues

Description

@spring-projects-issues

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

  1. Verify that the exception message above is generated regardless of the type of the enclosing transaction manager.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions