]
Ivo Studensky updated JBJCA-1392:
---------------------------------
Labels: downstream_dependency (was: )
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}