com.interface21.jdbc.core
Interface PreparedStatementCreator


public interface PreparedStatementCreator

One of the two central callback interfaces used by the JdbcTemplate class. This interface creates a PreparedStatement given a connection, provided by the JdbcTemplate class. Implementations are responsible for providing SQL and any necessary parameters. Implementations do not need to concern themselves with SQLExceptions that may be thrown from operations they attempt. The JdbcTemplate class will catch and handle SQLExceptions appropriately.

Author:
Rod Johnson

Method Summary
 java.sql.PreparedStatement createPreparedStatement(java.sql.Connection conn)
          Create a statement in this connection.
 java.lang.String getSql()
           
 

Method Detail

createPreparedStatement

public java.sql.PreparedStatement createPreparedStatement(java.sql.Connection conn)
                                                   throws java.sql.SQLException
Create a statement in this connection. Allows implementations to use PreparedStatements. Only invoked if no SQL is passed into the ResultSetHandler. The ResultSetHandler will close this statement.
Parameters:
conn - Connection to use to create statement
Returns:
a prepared statement
Throws:
java.sql.SQLException - there is no need to catch SQLExceptions that may be thrown in the implementation of this method. The JdbcTemplate class will handle them.

getSql

public java.lang.String getSql()


Rod Johnson and Spring contributors 2001-2003.