Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-16507

[GSS](7.2.z) JBJCA-1392 - Need to add checkTransaction handling for unwrap connection

XMLWordPrintable

      connection.setAutoCommit cannot affect unwrap native connection. The following mc.getAutoCommit result is true.

      c = dataSource.getConnection();
      c.setAutoCommit(false);
      if (c.isWrapperFor(oracle.jdbc.OracleConnection.class)) {
        mc = c.unwrap(oracle.jdbc.OracleConnection.class);
      }
      System.out.println("[JDBC 4 Wrapper] autoCommit : " + mc.getAutoCommit());
      

      However, the following getUnderlyingConnection native connection result is false.

      c = dataSource.getConnection();
      c.setAutoCommit(false);
      WrappedConnection wc = (WrappedConnection)c;
      oracle.jdbc.OracleConnection mc = (oracle.jdbc.OracleConnection)wc.getUnderlyingConnection();
      System.out.println("[org.jboss.ironjacamar.jdbcadapters WrappedConnection] autoCommit : " + mc.getAutoCommit());
      

      The getUnderlyingConnection method call BaseWrapperManagedConnection.checkTransaction process, but there is no similar process in unwrap method.

      org/jboss/jca/adapters/jdbc/BaseWrapperManagedConnection.java
         void checkTransaction() throws SQLException
         {
            synchronized (stateLock)
            {
               if (inManagedTransaction)
                  return;
      
               // Check autocommit
               if (jdbcAutoCommit != underlyingAutoCommit)
               {
                  con.setAutoCommit(jdbcAutoCommit);
                  underlyingAutoCommit = jdbcAutoCommit;
               }
            }
      

              istudens@redhat.com Ivo Studensky
              rhn-support-enagai Eiichi Nagai (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: