2 Replies Latest reply on Aug 28, 2001 2:47 PM by alex

    Problems with Session Beans and Persistence

      Hi Folks,

      I'm having some problems with the JBoss connection pool/hypersonic and stateful beans. I'm using JBoss 2.2 and I have deployed and Stateful Session bean. The bean uses Container Managed Transaction for all methods in the remote interface (the transaction attribute in the descriptor is TX_REQUIRED). Each of these methods follows the logic below:

      1 - get a connection from the pool
      2 - do some jdbc stuff
      3 - close connection

      This should be fine, since I'm acquiring and releasing the connection in the same transaction context. However, step 3 (closing the connection) corrups the database. I tried removing it, but my problems now are occurring in the passivation. The ejbPassivate method closes the connection (in order to return it to the pool) and sets the instance variable to null. But again, when the connection is closed, the hypersonic database gets corrupted (with repeated old data, as if it where commiting old transactions).

      Has anybody had similar problem? How can I fix this?

      Thanks
      Alex

        • 1. Re: Problems with Session Beans and Persistence
          davidjencks

          Just a couple of wild guesses, to try after you put the connection.close() back in the same method you got it in.

          1. Make sure your datasource is still loaded by XADataSourceLoader not JDBCDataSourceLoader. JDBCDataSourceLoader has nothing to do with the transaction manager.

          2. Make sure you are closing all resultsets and statements in that order before you close the connection.

          • 2. Re: Problems with Session Beans and Persistence

            Thanks for your reply.
            I added the close call back to the remote methods and tried again with version BETA 2.4. Looks like it is working fine now.

            Alex