Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-137

org.hibernate.TransactionException thrown when a transaction is directly rolledback (outside of tapestry-hibernate)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Abandoned
    • 5.0.15
    • None
    • None
    • None

    Description

      A "org.hibernate.TransactionException: Transaction not successfully started " occurs when a transaction is rolledback in tapestry-hibernate if the transaction has previously been rolledback. The problem is because HibernateSessionManagerImpl retains a reference to the transaction. So when HibernateSessionManagerImpl .threadDidCleanup() or HibernateSessionManagerImpl abort() is called it does not first check to see if the transaction reference has been rolled back (somewhere else) before calling rollback. One possible fix would be to call Transaction.wasRolledback() to determine if tapestry-hibernate should call trans.rollback(). Another would be to refrain from keeping a reference to the transaction and always call Session.beginTransaction().

      Q. Why not just inject HibernateSessionManager and call abort()?
      A. Because there are times when you do not have control over the code calling trans.rollback() for example in a third party library (which is how I ran into this).

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            buckofive Joe Klecko
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: