Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-9496

HibernateTransactionManager 'running within' exception message can be misleading

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.1 GA
    • Fix Version/s: General Backlog
    • Component/s: Data:ORM
    • Labels:
      None
    • Last commented by a User:
      true

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            juergen.hoeller Juergen Hoeller
            Reporter:
            sbrannen Sam Brannen
            Last updater:
            Spring Issues
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              2 years, 40 weeks, 2 days ago