2 Replies Latest reply on Oct 1, 2001 4:05 PM by Yanick Duchesne

    No Transaction message

    Yanick Duchesne Newbie

      I deployed a test session bean and configured a datasource connecting to an OODBMS (Gemstone). My session bean has been deployed with the trans-attribute "Required" for all its methods. The JDBC driver is a custom driver in which I have placed log statements. I have an insertData method that does the following:

      -acquire a connection;
      -inserts a record

      Here's some code:

      Context naming = new InitialContext();
      Object pool = naming.lookup("java:/GemstoneDB");
      log.report("got datasource GemstoneDB");
      DataSource dataSource = (DataSource)pool;
      log.report("getting connection to GemstoneDB");
      Connection conn = dataSource.getConnection();
      
      // insert the record
      
      conn.close()
      


      Now, my method is executed within a transaction (corresponding to the trans-attribute I have specified in my descriptor) and I have no error. Logically then, at the end of the transaction, I should have a commit. But when I look in the log of my driver, I see a rollback has occurred. Also, I get the following trace output on the jboss console, which states "No transaction right now". It is as if the container ignored my transaction attribute and did not invoke my method in the context of a transaction:

      [GemstoneDB] org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl created new Connection (com.newtrade.dql.query.jdbc.JDBCConnec
      tion) with XAResource org.jboss.pool.jdbc.xa.wrapper.XAResourceImpl and XAConnection org.jboss.pool.jdbc.xa.wrapper.XAConne
      ctionImpl.
      [GemstoneDB] No transaction right now.
      [GemstoneDB] Pool GemstoneDB [1/1/10] gave out new object: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@1abc69

      Does any one have a clue on what might happen?


        • 1. Re: No Transaction message
          Yanick Duchesne Newbie

          I forgot to mention: when getting the connection, I actually do the following:

          Connection conn = dataSource.getConnection();
          JDBCConnection myConn = JDBCConnection((XAClientConnection)conn).getUnderlyingConnection()
          // perform ops
          
          conn.close(); // XAClientConnection is returned to pool when close() is called
          


          So really, I do not deal with XAClientConnection but with my connection implementation; maybe that's the problem; maybe XAClientConnection tracks the Statement objects (keeps them until commit is called); since I use my instance of Connection (JDBCConnection) to invoke update(...), then XAClientConnection cannot keep track of my statements; on commit therefore, it has no statements cached and so does not call commit on the connection it encapsulates - in this case, an instance of JDBCConnection.

          Is this assumption right??? Is anyone more intimate with jboss' internal connection pooling/transaction mechanisms?



          • 2. Re: No Transaction message
            Yanick Duchesne Newbie

            Me again: FALSE ALERT! I was sure I had set my transaction type to Container (in the deployment descriptor), but it was to Bean... Sorry. I am ashamed.