2 Replies Latest reply on Sep 19, 2001 4:04 AM by bernd_v

    BMP transaction problems

    rndgatewaynet

      I am trying to refine the description of my situation,
      since i might said things unclear.

      I am using
      <trans-attribute>Required</trans-attribute>, for all remote
      and home methods.
      I have tried with every commit options (A,B,C,D) in
      jboss.xml, and the situation (for example) when using
      commit option A, and trans-attribute required is as follows.

      First i get,
      =========PostgreSQL log=============================
      2001-09-12 10:33:51 [18815] DEBUG: connection: host=127.0.0.1 user=postgres database=dynatest
      2001-09-12 10:33:51 [18815] DEBUG: query: set datestyle to 'ISO'; select getdatabaseencoding()
      2001-09-12 10:33:51 [18815] DEBUG: ProcessUtility: set datestyle to 'ISO'; select getdatabaseencoding()
      2001-09-12 10:33:51 [18815] DEBUG: query: begin
      2001-09-12 10:33:51 [18815] DEBUG: ProcessUtility: begin
      2001-09-12 10:33:51 [18815] DEBUG: query: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
      2001-09-12 10:33:51 [18815] DEBUG: ProcessUtility: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
      2001-09-12 10:33:51 [18815] DEBUG: query: rollback
      2001-09-12 10:33:51 [18815] DEBUG: ProcessUtility: rollback
      2001-09-12 10:33:51 [18815] DEBUG: query: begin
      2001-09-12 10:33:51 [18815] DEBUG: ProcessUtility: begin
      2001-09-12 10:33:51 [18815] DEBUG: query: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
      2001-09-12 10:33:51 [18815] DEBUG: ProcessUtility: SET TRANSACTION ISOLATION LEVEL READ COMMITTED

      (from the first pooled connection when jboss boots)

      Then when i use in the code NON-pooled connections
      (con = DriverManager.getConnection("jdbc:postgresql://localhost/dynatest","postgres","fooppass");

      i get

      ======PostgreSQL log (cont.)==========


      2001-09-12 10:41:13 [18906] DEBUG: connection: host=127.0.0.1 user=postgres database=dynatest
      2001-09-12 10:41:13 [18906] DEBUG: query: set datestyle to 'ISO'; select getdatabaseencoding()
      2001-09-12 10:41:13 [18906] DEBUG: ProcessUtility: set datestyle to 'ISO'; select getdatabaseencoding()
      2001-09-12 10:41:13 [18906] DEBUG: query: insert into savingsaccount values (
      '1' , 'ach' , 'bach' , 0.0 )
      2001-09-12 10:41:13 [18906] DEBUG: query: select firstname, lastname, balance
      from savingsaccount where id = '1'
      2001-09-12 10:41:13 [18906] DEBUG: query: update savingsaccount set firstname
      = 'ach' ,lastname = 'bach' , balance = 1000.0 where id = '1'
      2001-09-12 10:41:13 [18906] DEBUG: query: select firstname, lastname, balance
      from savingsaccount where id = '1'
      2001-09-12 10:41:13 [18906] DEBUG: query: update savingsaccount set firstname
      = 'ach' ,lastname = 'bach' , balance = 1000.0 where id = '1'

      -----------------------------------------

      I see here no presence of transactions as if i had declared NotSupported. (no begin-commit)

      Now with pooled connections in my code i get

      =====PostgreSQL.log========

      2001-09-12 10:54:03 [19190] DEBUG: query: insert into savingsaccount values (
      '1' , 'ach' , 'bach' , 0.0 )
      2001-09-12 10:54:03 [19190] DEBUG: query: commit
      2001-09-12 10:54:03 [19190] DEBUG: ProcessUtility: commit
      2001-09-12 10:54:03 [19190] DEBUG: query: begin
      2001-09-12 10:54:03 [19190] DEBUG: ProcessUtility: begin
      2001-09-12 10:54:03 [19190] DEBUG: query: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
      2001-09-12 10:54:03 [19190] DEBUG: ProcessUtility: SET TRANSACTION ISOLATION LEVEL READ COMMITTED
      2001-09-12 10:54:03 [19190] DEBUG: query: select firstname, lastname, balance
      from savingsaccount where id = '1'
      2001-09-12 10:54:03 [19190] DEBUG: query: update savingsaccount set firstname
      = 'ach' ,lastname = 'bach' , balance = 1000.0 where id = '1'
      2001-09-12 10:54:03 [19190] DEBUG: query: select firstname, lastname, balance
      from savingsaccount where id = '1'
      2001-09-12 10:54:03 [19190] DEBUG: query: update savingsaccount set firstname
      = 'ach' ,lastname = 'bach' , balance = 1000.0 where id = '1'

      -------------------------------

      That is,
      with ejbCreate it does commit, but it seems like ejbStore does not
      commit.

      I know maybe my last posting was a bit unclear, but i hope
      i have clarified things now.

      If any one wants i can give the sql create table statement, the code,
      and the EAR file to test him self.

      I am using JBoss2.4.0-tomcat3.2.3 with PostgreSQL 7.1.2
      (with the distribution jdbc driver).

        • 1. Re: BMP transaction problems
          rndgatewaynet

          con=datasource.getConnection() and
          con.close() at every database method solved the problem.
          I used to get a connection in setEntityContext, and
          close it in unsetEntityContext, and all these issues i described
          applied.
          Now it does begin-commit correctly (as expected).

          • 2. Re: BMP transaction problems
            bernd_v

            putting the following after each sql update or create helps:

            try {
            con.commit();
            } catch(Exception e){
            }

            con.commit() throws a exception, so it must be caught, but it works!!