--- mysql-connector-java-5.1.6/src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java Wed Mar 5 17:27:00 2008 +++ ../mysql-connector-java-5.1.6/src/com/mysql/jdbc/jdbc2/optional/JDBC4PreparedStatementWrapper.java Sun Mar 30 21:43:56 2008 @@ -63,12 +63,20 @@ } public void close() throws SQLException { + MysqlPooledConnection con = this.pooledConnection; try { super.close(); } finally { try { - ((JDBC4MysqlPooledConnection)this.pooledConnection).fireStatementEvent( - new StatementEvent(this.pooledConnection, this)); + StatementEvent e = new StatementEvent(con, this); + if (con instanceof JDBC4MysqlPooledConnection) { + ((JDBC4MysqlPooledConnection) con).fireStatementEvent(e); + + } else if (con instanceof JDBC4MysqlXAConnection) { + ((JDBC4MysqlXAConnection) con).fireStatementEvent(e); + } else if (con instanceof JDBC4SuspendableXAConnection) { + ((JDBC4SuspendableXAConnection) con).fireStatementEvent(e); + } } finally { this.unwrappedInterfaces = null; }