[jboss-jira] [JBoss JIRA] (JBJCA-1392) Need to add checkTransaction handling for unwrap connection
Ivo Studensky (Jira)
issues at jboss.org
Mon Aug 26 03:24:00 EDT 2019
[ https://issues.jboss.org/browse/JBJCA-1392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13775046#comment-13775046 ]
Ivo Studensky commented on JBJCA-1392:
--------------------------------------
This is going to 1.4.18.
> Need to add checkTransaction handling for unwrap connection
> -----------------------------------------------------------
>
> Key: JBJCA-1392
> URL: https://issues.jboss.org/browse/JBJCA-1392
> Project: IronJacamar
> Issue Type: Bug
> Components: JDBC
> Reporter: Ivo Studensky
> Assignee: Ivo Studensky
> Priority: Major
> Labels: downstream_dependency
>
> _connection.setAutoCommit_ cannot affect _unwrap_ native connection. The following _mc.getAutoCommit_ result is true.
> {code}
> 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());
> {code}
> However, the following _getUnderlyingConnection_ native connection result is false.
> {code}
> 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());
> {code}
> The _getUnderlyingConnection_ method call _BaseWrapperManagedConnection.checkTransaction_ process, but there is no similar process in _unwrap_ method.
> {code:title=org/jboss/jca/adapters/jdbc/BaseWrapperManagedConnection.java|borderStyle=solid}
> void checkTransaction() throws SQLException
> {
> synchronized (stateLock)
> {
> if (inManagedTransaction)
> return;
> // Check autocommit
> if (jdbcAutoCommit != underlyingAutoCommit)
> {
> con.setAutoCommit(jdbcAutoCommit);
> underlyingAutoCommit = jdbcAutoCommit;
> }
> }
> {code}
--
This message was sent by Atlassian Jira
(v7.12.1#712002)
More information about the jboss-jira
mailing list