Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-7195

On executing readonly query, WrappedConnection.checkTransactionStatus throws exception when transaction is marked for roll back


    • Type: Feature Request
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: JBossAS-4.2.3.GA, JBossAS-5.0.0.CR2, JBossAS-5.0.0.GA, JBossAS-5.0.1.GA, JBossAS-5.1.0.Beta1, JBossAS-5.1.0.CR1, JBossAS-5.1.0.GA
    • Fix Version/s: 6.0.0.M3
    • Component/s: JCA service
    • Labels:


      When using jboss 4.2.3 with our app, we got an error of this sort (not exact):
      Cannot Execute query.....Transaction status marked rollback
      Caused by: jboss.util.NestedSQLException
      at ...WrappedConnection.checkTransactionStatus

      Scenario when the above error happens:

      a) User submits request from a web page
      b) A jta transaction is started in a filter
      c) From UI layer, transaction is propagated to service layer with "Propation Required" setting.
      d) Service layer throws an exception (validation) and transaction is marked for rollback. Note that it is marked for rollback and not rolledback
      e) The ui layer now prepares the view which requires some db queries to be executed. As soon as the first query is tried to be executed, the above exception is thrown.

      I tried the above same steps with jboss 4.2.1 and it works fine. On further probing, found that in jboss 4.2.3, there was a change made as part of:

      From jira links above, intention seems to be to prevent update sqls from getting exectuted when transaction is marked for rollback. But looks like the code that was added does not discriminate between read-only and update sqls and prevents even a prepared statement from getting created - WrappedConnection.checkTransactionStatus throws an exception "cannot execute query" transaction marked for rollback.

      I believe that jca should discriminate between read only and update queries and should allow read only queries to go through when transaction is marked for rollback. These would allow the views to get generated in the same transaction. Ours is a 2-tier system (ui + service layer execute in the same jvm) and we are using Hibernate's recommended OpenSessionInViewPattern with one hib session+ one transaction per request.

      Anyone has any thoughts about this? Is it a legitimate concern? Else, the options before us are:
      a) refactor our code to have one hib session + 2 transactions (one for service layer and the other for the view). I believe even Jboss Seam does this.
      b) We have a roadmap to migrate to jboss 4.2.3 followed by jboss 5.1 within next 4 months. Then we'll have to ourselves change the Wrapped connection code to discriminate between read only and update queries.

        Gliffy Diagrams


            Issue Links



                • Assignee:
                  smarlow Scott Marlow
                  vijay2002 deepak aggarwal
                • Votes:
                  0 Vote for this issue
                  2 Start watching this issue


                  • Created: