Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-667

Hibernate exception stack is overridden by SetRollbackOnly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate Issue
    • Affects Version/s: 4.6.0
    • Fix Version/s: None
    • Component/s: JTA
    • Labels:
      None
    • Environment:

      OS: windows XP.
      Intel CPU

      Description

      The fix in https://jira.jboss.org/jira/browse/JBTM-66 makes the hibernate persistence exception lost in exception stack. For example, say there is a duplicate data constraint violation, hibernate entity manager calls calls transaction manager setRollbackOnly . However setRollbackOnly in TransactionImple.java sets the _rollbackOnlyCallerStacktrace which will be thrown as the exception cause later instead of the hibernate exception source. This makes the hibernate persistence exception unable to propagate to jboss clients. In this case, it is much more useful for hibernate exception information to be displayed to clients instead of the setRollbackOnly stack.

      The method in TransactionImple.java which throws the rollbackOnlyCallerStacktrace instead of _theTransaction.getDeferredThrowable()
      protected void commitAndDisassociate()
      throws javax.transaction.RollbackException,
      javax.transaction.HeuristicMixedException,
      javax.transaction.HeuristicRollbackException,
      java.lang.SecurityException, javax.transaction.SystemException,
      java.lang.IllegalStateException
      {

      . . .

      if(_rollbackOnlyCallerStacktrace != null)

      { // we rolled back beacuse the user explicitly told us not to commit. Attach the trace of who did that for debug: rollbackException.initCause(_rollbackOnlyCallerStacktrace); }

      else if(_theTransaction.getDeferredThrowable() != null)

      { // we tried to commit but it went wrong - attach the reason for debug: rollbackException.initCause(_theTransaction.getDeferredThrowable()); }

      Here should be the change related to issue JBTM-66 :

      http://viewvc.jboss.org/cgi-bin/viewvc.cgi/labs/labs/jbosstm/trunk/ArjunaJTA/jta/classes/com/arjuna/ats/internal/jta/transaction/arjunacore/TransactionImple.java?r1=25057&r2=25056&pathrev=25057

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                jhalliday Jonathan Halliday
                Reporter:
                terryxie Terry Xie
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: