D:\work\jboss_head\jboss-head\connector\src\main\org\jboss\resource\adapter\jdbc>cvs -q diff -u -N Index: BaseWrapperManagedConnection.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/BaseWrapperManagedConnection.java,v retrieving revision 1.17 diff -u -r1.17 BaseWrapperManagedConnection.java --- BaseWrapperManagedConnection.java 27 Dec 2005 15:29:31 -0000 1.17 +++ BaseWrapperManagedConnection.java 3 Jan 2006 13:44:57 -0000 @@ -252,7 +252,7 @@ } ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); ce.setConnectionHandle(handle); - Collection copy = null; + Collection copy; synchronized(cels) { copy = new ArrayList(cels); @@ -283,13 +283,13 @@ } } - Exception ex = null; + Exception ex; if (e instanceof Exception) ex = (Exception) e; else ex = new ResourceAdapterInternalException("Unexpected error", e); ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_ERROR_OCCURRED, ex); - Collection copy = null; + Collection copy; synchronized(cels) { copy = new ArrayList(cels); @@ -316,11 +316,12 @@ return con; } - PreparedStatement prepareStatement(String sql) throws SQLException + PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { if (psCache != null) { - final PreparedStatementCache.Key key = new PreparedStatementCache.Key(sql, PreparedStatementCache.Key.PREPARED_STATEMENT); + final PreparedStatementCache.Key key = new PreparedStatementCache.Key(sql, PreparedStatementCache.Key.PREPARED_STATEMENT, resultSetType, resultSetConcurrency); CachedPreparedStatement cachedps = (CachedPreparedStatement)psCache.get(key); if (cachedps != null) { @@ -344,12 +345,12 @@ boolean canUse(CachedPreparedStatement cachedps) { // Nobody is using it so we are ok - if (cachedps.isInUse() == false) + if (!cachedps.isInUse()) return true; // Cannot reuse prepared statements in auto commit mode // if will close the previous usage of the PS - if (underlyingAutoCommit == true) + if (underlyingAutoCommit) return false; // We have been told not to share @@ -411,7 +412,7 @@ boolean isJdbcAutoCommit() { - return inManagedTransaction? false: jdbcAutoCommit; + return !inManagedTransaction && jdbcAutoCommit; } void setJdbcAutoCommit(final boolean jdbcAutoCommit) throws SQLException @@ -510,10 +511,11 @@ throw new JBossResourceException("SQLException", e); } - public CallableStatement prepareCall(String sql) throws SQLException { + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { if (psCache != null) { - final PreparedStatementCache.Key key = new PreparedStatementCache.Key(sql, PreparedStatementCache.Key.CALLABLE_STATEMENT); + final PreparedStatementCache.Key key = new PreparedStatementCache.Key(sql, PreparedStatementCache.Key.CALLABLE_STATEMENT, resultSetType, resultSetConcurrency); CachedCallableStatement cachedps = (CachedCallableStatement)psCache.get(key); if (cachedps != null) { Index: PreparedStatementCache.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/PreparedStatementCache.java,v retrieving revision 1.8 diff -u -r1.8 PreparedStatementCache.java --- PreparedStatementCache.java 27 Dec 2005 15:29:31 -0000 1.8 +++ PreparedStatementCache.java 3 Jan 2006 13:47:59 -0000 @@ -42,33 +42,39 @@ public static final int CALLABLE_STATEMENT = 2; private final String sql; private final int type; + private final int resultSetType; + private final int resultSetConcurrency; - public Key(String sql, int type) - { - this.sql = sql; - this.type = type; - } - - public boolean equals(Object o) - { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final Key key = (Key) o; + public Key(String sql, int type, int resultSetType, int resultSetConcurrency) { + this.sql = sql; + this.type = type; + this.resultSetType = resultSetType; + this.resultSetConcurrency = resultSetConcurrency; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + final Key key = (Key) o; + + if (resultSetConcurrency != key.resultSetConcurrency) return false; + if (resultSetType != key.resultSetType) return false; + if (type != key.type) return false; + return !(sql != null ? !sql.equals(key.sql) : key.sql != null); + + } + + public int hashCode() { + int result; + result = (sql != null ? sql.hashCode() : 0); + result = 29 * result + type; + result = 29 * result + resultSetType; + result = 29 * result + resultSetConcurrency; + return result; + } - if (type != key.type) return false; - return !(sql != null ? !sql.equals(key.sql) : key.sql != null); - - } - - public int hashCode() - { - int result; - result = (sql != null ? sql.hashCode() : 0); - result = 29 * result + type; - return result; - } - public String toString() + public String toString() { StringBuffer tmp = new StringBuffer(super.toString()); tmp.append('['); @@ -76,6 +82,10 @@ tmp.append(sql); tmp.append("type="); tmp.append(type==PREPARED_STATEMENT ? "PS" : "CS"); + tmp.append("rstype="); + tmp.append(resultSetType); + tmp.append("rsconcur="); + tmp.append(resultSetConcurrency); tmp.append(']'); return tmp.toString(); } Index: WrappedConnection.java =================================================================== RCS file: /cvsroot/jboss/jbosscx/src/main/org/jboss/resource/adapter/jdbc/WrappedConnection.java,v retrieving revision 1.15 diff -u -r1.15 WrappedConnection.java --- WrappedConnection.java 27 Dec 2005 15:29:31 -0000 1.15 +++ WrappedConnection.java 3 Jan 2006 13:46:55 -0000 @@ -21,14 +21,7 @@ */ package org.jboss.resource.adapter.jdbc; -import java.sql.CallableStatement; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.Savepoint; -import java.sql.Statement; +import java.sql.*; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -183,7 +176,7 @@ checkTransaction(); try { - return new WrappedPreparedStatement(this, mc.prepareStatement(sql)); + return new WrappedPreparedStatement(this, mc.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)); } catch (Throwable t) { @@ -197,8 +190,7 @@ checkTransaction(); try { - return new WrappedPreparedStatement(this, mc.getConnection() - .prepareStatement(sql, resultSetType, resultSetConcurrency)); + return new WrappedPreparedStatement(this, mc.prepareStatement(sql, resultSetType, resultSetConcurrency)); } catch (Throwable t) { @@ -266,7 +258,7 @@ checkTransaction(); try { - return new WrappedCallableStatement(this, mc.prepareCall(sql)); + return new WrappedCallableStatement(this, mc.prepareCall(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)); } catch (Throwable t) { @@ -279,8 +271,7 @@ checkTransaction(); try { - return new WrappedCallableStatement(this, mc.getConnection() - .prepareCall(sql, resultSetType, resultSetConcurrency)); + return new WrappedCallableStatement(this, mc.prepareCall(sql, resultSetType, resultSetConcurrency)); } catch (Throwable t) {