1 Reply Latest reply on Oct 30, 2008 9:52 AM by vickyk

    Exception when rolling back jdbc connection inside managed t

    dvinod


      When i try to rollback JDBC connection inside a managed transaction (User Transaction) I am getting
      You cannot rollback during a managed transaction!
      When I looked at source code of Jboss BaseWrapperManagedConnection, I saw the below method explicitly throws this.
      void jdbcRollback(Savepoint savepoint) throws SQLException {

      if (inManagedTransaction)
      throw new SQLException("You cannot rollback during a managed transaction!");
      if (jdbcAutoCommit)
      throw new SQLException("You cannot rollback with autocommit set!");
      }

      Any suggestions please. I googled to find no relevant answer.

        • 1. Re: Exception when rolling back jdbc connection inside manag
          vickyk

           

          "dvinod" wrote:

          When i try to rollback JDBC connection inside a managed transaction (User Transaction) I am getting
          You cannot rollback during a managed transaction!


          You seem to be calling rollback() on the java.sql.Connection and not through the UserTransaction object.
          If you want to manage the transaction through the jdbc Connection object then configure the datasource of type no-tx-datasoure.
          More info can be obtained in JCA specs