Usul is taking a college course on Java programming, and it’s doing an excellent job preparing him for the real world. Already, he’s been forced to cope with someone who knows one true fact and has run off to apply it in the dumbest way possible. This would be his professor.

Our true fact is this: A Java PreparedStament object, used for running database queries, should be closed after use. This returns its connection to the pool and frees any resources the statement was using. You should do this, and you should do it as soon as you’re done with your connection.

Now, putting a call to stmt.close() in every finally block was just too much for Professor McCloseypants to deal with. So he provided this “convenience” object to deal with that problem.

It’s a lot of code, so we’re going to do this in pieces. First, let’s look at the declaration:

public class ClosingPreparedStatement {
    …
}

Now, remember, the purpose of this class is to do everything a PreparedStatement does, but add a self-closing behavior. Thus, the first problem here is that it doesn’t have an extends or implements declaration, so that it could share a common interface with PreparedStatements.

        /**
         *
         */
        public static boolean somethingFinalized = false;

Remember, this is a professor, providing this code as a model of what his students should be doing. For the capstone course, required for graduation.

Now, this is a wrapper around a PreparedStatement, so guess how most of the methods work…

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int executeUpdate(String arg0, String[] arg1) throws SQLException
        {
                return stmt.executeUpdate(arg0, arg1);
        }

Oh yeah. There are almost 1,300 lines of code in this file, and yes, they’re pretty much all like this. So, with all of that, how does this magical self-closing statement work?

        /**
         * Closes the internal statement and delegates
         *
         * @throws Throwable if the delegate throws it
         */
        protected void finalize() throws Throwable
        {
                try
                {
                        stmt.close();
                        somethingFinalized = true;
                } finally
                {
                        super.finalize();
                }
        }

He put it in the finalize method. If you’re not intimate with Java’s memory management, keep in mind: the finalize method is called by the garbage collector when it finally cleans up memory. You have no guarantees about when that will happen, or even if it ever well. So much for the “as soon as you’re done”.

Here is all 1,300ish lines of the file, in all its delegatory glory:

package datasource;

import java.io.InputStream;
import java.io.Reader;
import java.math.BigDecimal;
import java.net.URL;
import java.sql.Array;
import java.sql.Blob;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.Date;
import java.sql.NClob;
import java.sql.ParameterMetaData;
import java.sql.PreparedStatement;
import java.sql.Ref;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.RowId;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Calendar;

/**
 * This Prepared statement will always finalized itself to make sure that
 * everything gets cleaned up.
 */
public class ClosingPreparedStatement
{

        /**
         *
         */
        public static boolean somethingFinalized = false;

        private PreparedStatement stmt;

        /**
         * @param connection the connection
         * @param sql the sql for this statement
         * @throws SQLException if the prepared statement it contains throws an
         *             exception
         */
        public ClosingPreparedStatement(Connection connection, String sql) throws SQLException
        {
                stmt = connection.prepareStatement(sql);

        }

        /**
         *
         * @param connection the connection we should use
         * @param sql the statement we will execute
         * @param autoGeneratedKeys the keys
         * @throws SQLException if we can't create the statement
         */
        public ClosingPreparedStatement(Connection connection, String sql, int autoGeneratedKeys) throws SQLException
        {
                stmt = connection.prepareStatement(sql, autoGeneratedKeys);

        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegated call throws it
         */
        public void addBatch() throws SQLException
        {
                stmt.addBatch();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate
         * @throws SQLException if delegated call throws it
         */
        public void addBatch(String arg0) throws SQLException
        {
                stmt.addBatch(arg0);
        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegated call throws it
         */
        public void cancel() throws SQLException
        {
                stmt.cancel();
        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegate throws it
         */
        public void clearBatch() throws SQLException
        {
                stmt.clearBatch();
        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegate throws it
         */
        public void clearParameters() throws SQLException
        {
                stmt.clearParameters();
        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegate throws it
         */
        public void clearWarnings() throws SQLException
        {
                stmt.clearWarnings();
        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegate throws it
         */
        public void close() throws SQLException
        {
                stmt.close();
        }

        /**
         * Just delegates
         *
         * @throws SQLException if delegate throws it
         */
        public void closeOnCompletion() throws SQLException
        {
                stmt.closeOnCompletion();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean execute() throws SQLException
        {
                return stmt.execute();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @return the delgate's return value
         * @throws SQLException if delegate throws it
         */
        public boolean execute(String arg0) throws SQLException
        {
                return stmt.execute(arg0);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean execute(String arg0, int arg1) throws SQLException
        {
                return stmt.execute(arg0, arg1);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean execute(String arg0, int[] arg1) throws SQLException
        {
                return stmt.execute(arg0, arg1);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean execute(String arg0, String[] arg1) throws SQLException
        {
                return stmt.execute(arg0, arg1);
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int[] executeBatch() throws SQLException
        {
                return stmt.executeBatch();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public ResultSet executeQuery() throws SQLException
        {
                return stmt.executeQuery();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public ResultSet executeQuery(String arg0) throws SQLException
        {
                return stmt.executeQuery(arg0);
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int executeUpdate() throws SQLException
        {
                return stmt.executeUpdate();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int executeUpdate(String arg0) throws SQLException
        {
                return stmt.executeUpdate(arg0);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int executeUpdate(String arg0, int arg1) throws SQLException
        {
                return stmt.executeUpdate(arg0, arg1);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int executeUpdate(String arg0, int[] arg1) throws SQLException
        {
                return stmt.executeUpdate(arg0, arg1);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param arg1 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int executeUpdate(String arg0, String[] arg1) throws SQLException
        {
                return stmt.executeUpdate(arg0, arg1);
        }

        /**
         * Closes the internal statement and delegates
         *
         * @throws Throwable if the delegate throws it
         */
        protected void finalize() throws Throwable
        {
                try
                {
                        stmt.close();
                        somethingFinalized = true;
                } finally
                {
                        super.finalize();
                }
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public java.sql.Connection getConnection() throws SQLException
        {
                return stmt.getConnection();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getFetchDirection() throws SQLException
        {
                return stmt.getFetchDirection();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getFetchSize() throws SQLException
        {
                return stmt.getFetchSize();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public ResultSet getGeneratedKeys() throws SQLException
        {
                return stmt.getGeneratedKeys();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getMaxFieldSize() throws SQLException
        {
                return stmt.getMaxFieldSize();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getMaxRows() throws SQLException
        {
                return stmt.getMaxRows();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public ResultSetMetaData getMetaData() throws SQLException
        {
                return stmt.getMetaData();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean getMoreResults() throws SQLException
        {
                return stmt.getMoreResults();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean getMoreResults(int arg0) throws SQLException
        {
                return stmt.getMoreResults(arg0);
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public ParameterMetaData getParameterMetaData() throws SQLException
        {
                return stmt.getParameterMetaData();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getQueryTimeout() throws SQLException
        {
                return stmt.getQueryTimeout();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public ResultSet getResultSet() throws SQLException
        {
                return stmt.getResultSet();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getResultSetConcurrency() throws SQLException
        {
                return stmt.getResultSetConcurrency();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getResultSetHoldability() throws SQLException
        {
                return stmt.getResultSetHoldability();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getResultSetType() throws SQLException
        {
                return stmt.getResultSetType();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public int getUpdateCount() throws SQLException
        {
                return stmt.getUpdateCount();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public SQLWarning getWarnings() throws SQLException
        {
                return stmt.getWarnings();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean isClosed() throws SQLException
        {
                return stmt.isClosed();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean isCloseOnCompletion() throws SQLException
        {
                return stmt.isCloseOnCompletion();
        }

        /**
         * Just delegates
         *
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean isPoolable() throws SQLException
        {
                return stmt.isPoolable();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @return the delegates return value
         * @throws SQLException if delegate throws it
         */
        public boolean isWrapperFor(Class<?> arg0) throws SQLException
        {
                return stmt.isWrapperFor(arg0);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setArray(int parameterIndex, Array x) throws SQLException
        {
                stmt.setArray(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setAsciiStream(int parameterIndex, InputStream x) throws SQLException
        {
                stmt.setAsciiStream(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException
        {
                stmt.setAsciiStream(parameterIndex, x, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setAsciiStream(int parameterIndex, InputStream x, long length) throws SQLException
        {
                stmt.setAsciiStream(parameterIndex, x, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException
        {
                stmt.setBigDecimal(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBinaryStream(int parameterIndex, InputStream x) throws SQLException
        {
                stmt.setBinaryStream(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException
        {
                stmt.setBinaryStream(parameterIndex, x, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBinaryStream(int parameterIndex, InputStream x, long length) throws SQLException
        {
                stmt.setBinaryStream(parameterIndex, x, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBlob(int parameterIndex, Blob x) throws SQLException
        {
                stmt.setBlob(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param inputStream delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBlob(int parameterIndex, InputStream inputStream) throws SQLException
        {
                stmt.setBlob(parameterIndex, inputStream);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param inputStream delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException
        {
                stmt.setBlob(parameterIndex, inputStream, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBoolean(int parameterIndex, boolean x) throws SQLException
        {
                stmt.setBoolean(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setByte(int parameterIndex, byte x) throws SQLException
        {
                stmt.setByte(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setBytes(int parameterIndex, byte[] x) throws SQLException
        {
                stmt.setBytes(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setCharacterStream(int parameterIndex, Reader reader) throws SQLException
        {
                stmt.setCharacterStream(parameterIndex, reader);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException
        {
                stmt.setCharacterStream(parameterIndex, reader, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setCharacterStream(int parameterIndex, Reader reader, long length) throws SQLException
        {
                stmt.setCharacterStream(parameterIndex, reader, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setClob(int parameterIndex, Clob x) throws SQLException
        {
                stmt.setClob(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setClob(int parameterIndex, Reader reader) throws SQLException
        {
                stmt.setClob(parameterIndex, reader);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setClob(int parameterIndex, Reader reader, long length) throws SQLException
        {
                stmt.setClob(parameterIndex, reader, length);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setCursorName(String arg0) throws SQLException
        {
                stmt.setCursorName(arg0);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setDate(int parameterIndex, Date x) throws SQLException
        {
                stmt.setDate(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param cal delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException
        {
                stmt.setDate(parameterIndex, x, cal);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setDouble(int parameterIndex, double x) throws SQLException
        {
                stmt.setDouble(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setEscapeProcessing(boolean arg0) throws SQLException
        {
                stmt.setEscapeProcessing(arg0);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setFetchDirection(int arg0) throws SQLException
        {
                stmt.setFetchDirection(arg0);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setFetchSize(int arg0) throws SQLException
        {
                stmt.setFetchSize(arg0);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setFloat(int parameterIndex, float x) throws SQLException
        {
                stmt.setFloat(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setInt(int parameterIndex, int x) throws SQLException
        {
                stmt.setInt(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setLong(int parameterIndex, long x) throws SQLException
        {
                stmt.setLong(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setMaxFieldSize(int arg0) throws SQLException
        {
                stmt.setMaxFieldSize(arg0);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setMaxRows(int arg0) throws SQLException
        {
                stmt.setMaxRows(arg0);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param value delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
        {
                stmt.setNCharacterStream(parameterIndex, value);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param value delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
        {
                stmt.setNCharacterStream(parameterIndex, value, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param value delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNClob(int parameterIndex, NClob value) throws SQLException
        {
                stmt.setNClob(parameterIndex, value);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNClob(int parameterIndex, Reader reader) throws SQLException
        {
                stmt.setNClob(parameterIndex, reader);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param reader delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNClob(int parameterIndex, Reader reader, long length) throws SQLException
        {
                stmt.setNClob(parameterIndex, reader, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param value delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNString(int parameterIndex, String value) throws SQLException
        {
                stmt.setNString(parameterIndex, value);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param sqlType delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNull(int parameterIndex, int sqlType) throws SQLException
        {
                stmt.setNull(parameterIndex, sqlType);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param sqlType delegate's parameter
         * @param typeName delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException
        {
                stmt.setNull(parameterIndex, sqlType, typeName);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setObject(int parameterIndex, Object x) throws SQLException
        {
                stmt.setObject(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param targetSqlType delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException
        {
                stmt.setObject(parameterIndex, x, targetSqlType);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param targetSqlType delegate's parameter
         * @param scaleOrLength delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setObject(int parameterIndex, Object x, int targetSqlType, int scaleOrLength) throws SQLException
        {
                stmt.setObject(parameterIndex, x, targetSqlType, scaleOrLength);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setPoolable(boolean arg0) throws SQLException
        {
                stmt.setPoolable(arg0);
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setQueryTimeout(int arg0) throws SQLException
        {
                stmt.setQueryTimeout(arg0);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setRef(int parameterIndex, Ref x) throws SQLException
        {
                stmt.setRef(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setRowId(int parameterIndex, RowId x) throws SQLException
        {
                stmt.setRowId(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setShort(int parameterIndex, short x) throws SQLException
        {
                stmt.setShort(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param xmlObject delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
        {
                stmt.setSQLXML(parameterIndex, xmlObject);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setString(int parameterIndex, String x) throws SQLException
        {
                stmt.setString(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setTime(int parameterIndex, Time x) throws SQLException
        {
                stmt.setTime(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param cal delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException
        {
                stmt.setTime(parameterIndex, x, cal);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException
        {
                stmt.setTimestamp(parameterIndex, x);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param cal delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException
        {
                stmt.setTimestamp(parameterIndex, x, cal);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @param length delegate's parameter
         * @throws SQLException if delegate throws it
         *
         */
        @Deprecated
        public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException
        {
                stmt.setUnicodeStream(parameterIndex, x, length);
        }

        /**
         * Just delegates
         *
         * @param parameterIndex delegate's parameter
         * @param x delegate's parameter
         * @throws SQLException if delegate throws it
         */
        public void setURL(int parameterIndex, URL x) throws SQLException
        {
                stmt.setURL(parameterIndex, x);
        }

        /**
         * @see java.lang.Object#toString()
         */
        public String toString()
        {
                return stmt.toString();
        }

        /**
         * Just delegates
         *
         * @param arg0 delegate's parameter
         * @param <T> delegate's parameter
         * @return delegate's return value
         * @throws SQLException if delegate throws it
         */
        public <T> T unwrap(Class<T> arg0) throws SQLException
        {
                return stmt.unwrap(arg0);
        }
}
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!