0 Replies Latest reply on Jul 14, 2005 5:22 PM by g king

    JBossTransactionRolledbackLocalException

    g king Newbie

      Here's the story:

      I have a Session bean which acts upon two different databases.

      The session bean first updates db1 through an entity bean.

      The session then calls upon a different SLSB which in turn updates
      db2 through another entity bean.

      However, do to some db constraints, the update to db2 continuously fails and the transaction on db1 is allowed to commit.

      org.jboss.tm.JBossTransactionRolledbackLocalException: null; CausedByException is:
      Unable to commit, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=localhost/40, BranchQual=, localId=40] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: null; CausedByException is:
      [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]UPDATE statement conflicted with COLUMN REFERENCE constraint

      I have set restrictions whithin the ejb-jar.xml which I hoped would alleviate inconsistent data:

      <container-transaction>
      <-method->
      <ejb-name>DB1Administration</ejb-name>
      <method-name>updateRoleByApplication</method-name>
      <-/method->
      <trans-attribute>RequiresNew</trans-attribute>
      </container-transaction>

      <container-transaction>
      <-method->
      <ejb-name>DB2Administration</ejb-name>
      <method-name>updateSecurityGroup</method-name>
      <-/method->
      <trans-attribute>Required</trans-attribute>
      </container-transaction>

      Any clues? The status=STATUS_NO_TRANSACTION has me a little nervous. A SQLTrace shows both calls to be rolled back, but, the 1st isn't.

      SET IMPLICIT_TRANSACTIONS ON
      exec sp_cursoropen @P1 output, N'SELECT Security
      exec sp_executesql N'UPDATE Role SET
      exec sp_executesql N'UPDATE User SET
      IF @@TRANCOUNT > 0 ROLLBACK TRAN
      IF @@TRANCOUNT > 0 ROLLBACK TRAN
      SET IMPLICIT_TRANSACTIONS OFF

      Thanks