title: How to get the transaction Status from HibernateTransactionManager
body: <p>I am trying to upgrade my spring transaction manager from <strong>JtaTransactionManager</strong> to <strong>HibernateTransactionManager</strong>. In JTA TransactionManager we have one method which gives the status of current transaction. Based on the status we are doing some operations. The implementation is as follows :</p>
  
  <pre><code>private void checkTransactionStatus(TransactionStatus status){
               if(status instanceof DefaultTransactionStatus) {
                  DefaultTransactionStatus transactionStatus = (DefaultTransactionStatus) status;
                  if(transactionStatus.getTransaction() instanceof JtaTransactionObject){
                      JtaTransactionObject txObject = (JtaTransactionObject) transactionStatus.getTransaction();
                      int jtaStatus;
                      try {
                          jtaStatus = txObject.getUserTransaction().getStatus();
                          if(jtaStatus==Status.STATUS_MARKED_ROLLBACK){
                              // logic heare
                          }
                      } catch (SystemException e) {}
                  }
               }
             }
  </code></pre>
  
  <p>I want to replace this method with HibernateTransactionManager specific code. I analyzed and found that, HibernateTransactionManager is using   <strong>HibernateTransactionObject</strong> as transaction object. But, unfortunately it's a private inner class that I can't use to get the status. Then I tried to use the parent class <strong>JdbcTransactionObjectSupport</strong>. But, I don't know how to get the status from this parent class object. </p>
  
  <pre><code>private void checkTransactionStatus(TransactionStatus status){
           if(status instanceof DefaultTransactionStatus) {
              DefaultTransactionStatus transactionStatus = (DefaultTransactionStatus) status;
              if(transactionStatus.getTransaction() instanceof JdbcTransactionObjectSupport){
                  JdbcTransactionObjectSupport txObject = (JdbcTransactionObjectSupport) transactionStatus.getTransaction();
                  //how to get the current status ?
              }
           }
         }
  </code></pre>