title: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed
body: <p>I have an application which contains a webservice  that use Spring and hibernate in order to retrieve data from database.
  Other applications invoke this webservice in their application.</p>
  
  <p>The flow of webservice :</p>
  
  <p>Webservice class method (calls manager class method) --> Manager class method ---> that calls DAO method ) </p>
  
  <pre><code> Webservice class :
  
   public List getXXX(){
        managerClass.getXX();
  
    }
  
   manager Class:
  
   @Transactional(readOnly=true)
  
   Public List getXX(){
        DAOClass.getX();
    }
  </code></pre>
  
  <p>DAO class(It is using hibernate and logic to retrieve data) :</p>
  
  <pre><code>   public List getX(){
        Criteria query 
       =getSessionFactory().getCurrentSession()
     .createCriteria(dataObject.class);
      query.add(Restrictions.eq(dataObject.type, systemId));
      query.addOrder(Order.asc(dataObject.TYPE));
      query.addOrder(Order.asc(dataObject.code));
  
      return query.list();
  
      }
  </code></pre>
  
  <p>This Webservice method(by calling manager and DAO classes)  giving the list from database. It is working fine all the time except sometimes.</p>
  
  <p>I am not updating or inserting any data,I am just getting the data</p>
  
  <p>(The flow is : Webservice --> manager Class--> DAO --> hibernate)</p>
  
  <p>One client is accessing this method to get the List in their application.he is getting the data properly all the time.But sometimes he is getting this Exception :</p>
  
  <blockquote>
    <p>javax.xml.ws.soap.SOAPFaultException: Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed<br>
                   at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1346)<br>
                   at org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.demarshalFaultResponse(MethodMarshallerUtils.java:1072)<br>
                   at org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMethodMarshaller.demarshalFaultResponse(DocLitWrappedMethodMarshaller.java:593)<br>
                   at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:559)<br>
                   at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:497)<br>
                   at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:404)<br>
                   at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:208)<br></p>
  </blockquote>
  
  <p>According to Spring default behavior, whenever the exception is thrown, it tries to roll back.That is what it is trying, but somehow could not rollback. As it is declarative transaction by using annotations, How can I track exact reason for this exception? based on the exception, I definitely know the DAO class method is throwing exception.but I am not able to track the exact reason(whether connection closed issue or any other thing).i just want to use exception handling in DAO class in order  to know the exact reason.Can I use try/catch block  in DAO class method to have stack trace that prints the exact reason?
  I just want to remind once again, it is working fine all the time, but sometimes it is not working because of this exception.</p>
  
  <p>I hope I clearly explained my problem.Please do the needful by giving solution.</p>