org.springframework.jdbc.core
Class JdbcTemplate

public class JdbcTemplate
extends JdbcAccessor
implements JdbcOperations
This is the central class in the JDBC core package. It simplifies the use of JDBC and helps to avoid common errors. It executes core JDBC workflow, leaving application code to provide SQL and extract results. This class executes SQL queries or updates, initiating iteration over ResultSets and catching JDBC exceptions and translating them to the generic, more informative exception hierarchy defined in the org.springframework.dao package.

Code using this class need only implement callback interfaces, giving them a clearly defined contract. The PreparedStatementCreator callback interface creates a prepared statement given a Connection provided by this class, providing SQL and any necessary parameters. The RowCallbackHandler interface extracts values from each row of a ResultSet.

Can be used within a service implementation via direct instantiation with a DataSource reference, or get prepared in an application context and given to services as bean reference. Note: The DataSource should always be configured as a bean in the application context, in the first case given to the service directly, in the second case to the prepared template.

The motivation and design of this class is discussed in detail in Expert One-On-One J2EE Design and Development by Rod Johnson (Wrox, 2002).

Because this class is parameterizable by the callback interfaces and the SQLExceptionTranslator interface, it isn't necessary to subclass it. All operations performed by this class are logged at debug level.

SinceMay 3, 200
VersionNot specified.
AuthorRod Johnson, Juergen Hoeller, Thomas Risberg
Wiki javadoc Use textile entry format.

j

Fields inherited from org.springframework.jdbc.supportJdbcAccessor
Constructor Summary
JdbcTemplate()
Construct a new JdbcTemplate for bean usage.
JdbcTemplate( DataSource dataSource )
Construct a new JdbcTemplate, given a DataSource to obtain connections from.
JdbcTemplate( DataSource dataSource, boolean lazyInit )
Construct a new JdbcTemplate, given a DataSource to obtain connections from.
Method Summary
protected void applyStatementSettings( Statement stmt )
Prepare the given JDBC Statement (or PreparedStatement or CallableStatement), applying statement settings such as fetch size, max rows, and query timeout.
int[] batchUpdate( String [] sql )
No description provided.
int[] batchUpdate( String sql, BatchPreparedStatementSetter pss )
No description provided.
Map call( CallableStatementCreator csc, List declaredParameters )
No description provided.
protected Connection createConnectionProxy( Connection con )
Create a close-suppressing proxy for the given JDBC Connection.
Object execute( ConnectionCallback action )
No description provided.
Object execute( StatementCallback action )
No description provided.
void execute( String sql )
No description provided.
Object execute( PreparedStatementCreator psc, PreparedStatementCallback action )
No description provided.
Object execute( String sql, PreparedStatementCallback action )
No description provided.
Object execute( CallableStatementCreator csc, CallableStatementCallback action )
No description provided.
Object execute( String callString, CallableStatementCallback action )
No description provided.
protected Map extractOutputParameters( CallableStatement cs, List parameters )
Extract output parameters from the completed stored procedure.
protected Map extractReturnedResultSets( CallableStatement cs, List parameters, int updateCount )
Extract returned ResultSets from the completed stored procedure.
protected RowMapper getColumnMapRowMapper()
Create a new RowMapper for reading columns as key-value pairs.
int getFetchSize()
Return the fetch size specified for this JdbcTemplate.
int getMaxRows()
Return the maximum number of rows specified for this JdbcTemplate.
NativeJdbcExtractor getNativeJdbcExtractor()
Return the current NativeJdbcExtractor implementation.
protected RowMapper getSingleColumnRowMapper( Class requiredType )
Create a new RowMapper for reading result objects from a single column.
boolean isIgnoreWarnings()
Return whether or not we ignore SQLWarnings.
protected Map processResultSet( ResultSet rs, ResultSetSupportingSqlParameter param )
Process the given ResultSet from a stored procedure.
Object query( String sql, ResultSetExtractor rse )
No description provided.
List query( String sql, RowCallbackHandler rch )
No description provided.
List query( String sql, RowMapper rowMapper )
No description provided.
Object query( PreparedStatementCreator psc, PreparedStatementSetter pss, ResultSetExtractor rse )
Query using a prepared statement, allowing for a PreparedStatementCreator and a PreparedStatementSetter.
Object query( PreparedStatementCreator psc, ResultSetExtractor rse )
No description provided.
Object query( String sql, PreparedStatementSetter pss, ResultSetExtractor rse )
No description provided.
Object query( String sql, Object [] args, int [] argTypes, ResultSetExtractor rse )
No description provided.
Object query( String sql, Object [] args, ResultSetExtractor rse )
No description provided.
List query( PreparedStatementCreator psc, RowCallbackHandler rch )
No description provided.
List query( String sql, PreparedStatementSetter pss, RowCallbackHandler rch )
No description provided.
List query( String sql, Object [] args, int [] argTypes, RowCallbackHandler rch )
No description provided.
List query( String sql, Object [] args, RowCallbackHandler rch )
No description provided.
List query( PreparedStatementCreator psc, RowMapper rowMapper )
No description provided.
List query( String sql, PreparedStatementSetter pss, RowMapper rowMapper )
No description provided.
List query( String sql, Object [] args, int [] argTypes, RowMapper rowMapper )
No description provided.
List query( String sql, Object [] args, RowMapper rowMapper )
No description provided.
int queryForInt( String sql )
No description provided.
int queryForInt( String sql, Object [] args, int [] argTypes )
No description provided.
int queryForInt( String sql, Object [] args )
No description provided.
List queryForList( String sql, Class elementType )
No description provided.
List queryForList( String sql )
No description provided.
List queryForList( String sql, Object [] args, int [] argTypes, Class elementType )
No description provided.
List queryForList( String sql, Object [] args, Class elementType )
No description provided.
List queryForList( String sql, Object [] args, int [] argTypes )
No description provided.
List queryForList( String sql, Object [] args )
No description provided.
long queryForLong( String sql )
No description provided.
long queryForLong( String sql, Object [] args, int [] argTypes )
No description provided.
long queryForLong( String sql, Object [] args )
No description provided.
Map queryForMap( String sql )
No description provided.
Map queryForMap( String sql, Object [] args, int [] argTypes )
No description provided.
Map queryForMap( String sql, Object [] args )
No description provided.
Object queryForObject( String sql, RowMapper rowMapper )
No description provided.
Object queryForObject( String sql, Class requiredType )
No description provided.
Object queryForObject( String sql, Object [] args, int [] argTypes, RowMapper rowMapper )
No description provided.
Object queryForObject( String sql, Object [] args, RowMapper rowMapper )
No description provided.
Object queryForObject( String sql, Object [] args, int [] argTypes, Class requiredType )
No description provided.
Object queryForObject( String sql, Object [] args, Class requiredType )
No description provided.
SqlRowSet queryForRowSet( String sql )
No description provided.
SqlRowSet queryForRowSet( String sql, Object [] args, int [] argTypes )
No description provided.
SqlRowSet queryForRowSet( String sql, Object [] args )
No description provided.
void setFetchSize( int fetchSize )
Set the fetch size for this JdbcTemplate.
void setIgnoreWarnings( boolean ignoreWarnings )
Set whether or not we want to ignore SQLWarnings.
void setMaxRows( int maxRows )
Set the maximum number of rows for this JdbcTemplate.
void setNativeJdbcExtractor( NativeJdbcExtractor extractor )
Set a NativeJdbcExtractor to extract native JDBC objects from wrapped handles.
int update( String sql )
No description provided.
protected int update( PreparedStatementCreator psc, PreparedStatementSetter pss )
No description provided.
int update( PreparedStatementCreator psc )
No description provided.
int update( PreparedStatementCreator psc, KeyHolder generatedKeyHolder )
No description provided.
int update( String sql, PreparedStatementSetter pss )
No description provided.
int update( String sql, Object [] args, int [] argTypes )
No description provided.
int update( String sql, Object [] args )
No description provided.
Methods inherited from org.springframework.beans.factoryInitializingBean
JdbcTemplate
public JdbcTemplate ( )
Construct a new JdbcTemplate for bean usage. Note: The DataSource has to be set before using the instance. This constructor can be used to prepare a JdbcTemplate via a BeanFactory, typically setting the DataSource via setDataSource.
Wiki javadoc Use textile entry format.
Add your comments here.
JdbcTemplate
public JdbcTemplate ( DataSource dataSource )
Construct a new JdbcTemplate, given a DataSource to obtain connections from. Note: This will not trigger initialization of the exception translator.
Parameters
TypeNameDescription
DataSource dataSource JDBC DataSource to obtain connections from
Wiki javadoc Use textile entry format.
Add your comments here.
JdbcTemplate
public JdbcTemplate ( DataSource dataSource, boolean lazyInit )
Construct a new JdbcTemplate, given a DataSource to obtain connections from. Note: Depending on the "lazyInit" flag, initialization of the exception translator will be triggered.
Parameters
TypeNameDescription
DataSource dataSource JDBC DataSource to obtain connections from
boolean lazyInit whether to lazily initialize the SQLExceptionTranslator
Wiki javadoc Use textile entry format.
Add your comments here.
applyStatementSettings
protected void applyStatementSettings ( Statement stmt )
throws
Prepare the given JDBC Statement (or PreparedStatement or CallableStatement), applying statement settings such as fetch size, max rows, and query timeout.
Parameters
TypeNameDescription
Statement stmt the JDBC Statement to prepare
Returns void No description provided.
Exceptions
SQLException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
batchUpdate
public int[] batchUpdate ( String [] sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String [] sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
batchUpdate
public int[] batchUpdate ( String sql, BatchPreparedStatementSetter pss )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
BatchPreparedStatementSetter pss No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
call
public Map call ( CallableStatementCreator csc, List declaredParameters )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
CallableStatementCreator csc No description provided.
List declaredParameters No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
createConnectionProxy
protected Connection createConnectionProxy ( Connection con )
Create a close-suppressing proxy for the given JDBC Connection. Called by the execute method.

The proxy also prepares returned JDBC Statements, applying statement settings such as fetch size, max rows, and query timeout.

Parameters
TypeNameDescription
Connection con the JDBC Connection to create a proxy for
Wiki javadoc Use textile entry format.
Add your comments here.
execute
public Object execute ( ConnectionCallback action )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
ConnectionCallback action No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
execute
public Object execute ( StatementCallback action )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
StatementCallback action No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
execute
public void execute ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Returns void No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
execute
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
PreparedStatementCallback action No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
execute
public Object execute ( String sql, PreparedStatementCallback action )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
PreparedStatementCallback action No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
execute
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
CallableStatementCreator csc No description provided.
CallableStatementCallback action No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
execute
public Object execute ( String callString, CallableStatementCallback action )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String callString No description provided.
CallableStatementCallback action No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
extractOutputParameters
protected Map extractOutputParameters ( CallableStatement cs, List parameters )
throws
Extract output parameters from the completed stored procedure.
Parameters
TypeNameDescription
CallableStatement cs JDBC wrapper for the stored procedure
List parameters parameter list for the stored procedure
Exceptions
SQLException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
extractReturnedResultSets
protected Map extractReturnedResultSets ( CallableStatement cs, List parameters, int updateCount )
throws
Extract returned ResultSets from the completed stored procedure.
Parameters
TypeNameDescription
CallableStatement cs JDBC wrapper for the stored procedure
List parameters Parameter list for the stored procedure
int updateCount No description provided.
Exceptions
SQLException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
getColumnMapRowMapper
protected RowMapper getColumnMapRowMapper ( )
Create a new RowMapper for reading columns as key-value pairs.
Wiki javadoc Use textile entry format.
Add your comments here.
getFetchSize
public int getFetchSize ( )
Return the fetch size specified for this JdbcTemplate.
Wiki javadoc Use textile entry format.
Add your comments here.
getMaxRows
public int getMaxRows ( )
Return the maximum number of rows specified for this JdbcTemplate.
Wiki javadoc Use textile entry format.
Add your comments here.
getNativeJdbcExtractor
public NativeJdbcExtractor getNativeJdbcExtractor ( )
Return the current NativeJdbcExtractor implementation.
Wiki javadoc Use textile entry format.
Add your comments here.
getSingleColumnRowMapper
protected RowMapper getSingleColumnRowMapper ( Class requiredType )
Create a new RowMapper for reading result objects from a single column.
Parameters
TypeNameDescription
Class requiredType the type that each result object is expected to match
Wiki javadoc Use textile entry format.
Add your comments here.
isIgnoreWarnings
public boolean isIgnoreWarnings ( )
Return whether or not we ignore SQLWarnings. Default is "true".
Wiki javadoc Use textile entry format.
Add your comments here.
processResultSet
protected Map processResultSet ( ResultSet rs, ResultSetSupportingSqlParameter param )
throws
Process the given ResultSet from a stored procedure.
Parameters
TypeNameDescription
ResultSet rs the ResultSet to process
ResultSetSupportingSqlParameter param the corresponding stored procedure parameter
Exceptions
SQLException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public Object query ( String sql, ResultSetExtractor rse )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
ResultSetExtractor rse No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, RowCallbackHandler rch )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
RowCallbackHandler rch No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
Query using a prepared statement, allowing for a PreparedStatementCreator and a PreparedStatementSetter. Most other query methods use this method, but application code will always work with either a creator or a setter.
Parameters
TypeNameDescription
PreparedStatementCreator psc Callback handler that can create a PreparedStatement given a Connection
PreparedStatementSetter pss object that knows how to set values on the prepared statement. If this is null, the SQL will be assumed to contain no bind parameters.
ResultSetExtractor rse object that will extract results.
Exceptions
DataAccessException if there is any problem
Wiki javadoc Use textile entry format.
Add your comments here.
query
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
ResultSetExtractor rse No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
PreparedStatementSetter pss No description provided.
ResultSetExtractor rse No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public Object query ( String sql, Object [] args, int [] argTypes, ResultSetExtractor rse )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
ResultSetExtractor rse No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public Object query ( String sql, Object [] args, ResultSetExtractor rse )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
ResultSetExtractor rse No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
RowCallbackHandler rch No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
PreparedStatementSetter pss No description provided.
RowCallbackHandler rch No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, Object [] args, int [] argTypes, RowCallbackHandler rch )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
RowCallbackHandler rch No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, Object [] args, RowCallbackHandler rch )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
RowCallbackHandler rch No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( PreparedStatementCreator psc, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, PreparedStatementSetter pss, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
PreparedStatementSetter pss No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, Object [] args, int [] argTypes, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
query
public List query ( String sql, Object [] args, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForInt
public int queryForInt ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForInt
public int queryForInt ( String sql, Object [] args, int [] argTypes )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForInt
public int queryForInt ( String sql, Object [] args )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForList
public List queryForList ( String sql, Class elementType )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Class elementType No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForList
public List queryForList ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForList
public List queryForList ( String sql, Object [] args, int [] argTypes, Class elementType )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Class elementType No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForList
public List queryForList ( String sql, Object [] args, Class elementType )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Class elementType No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForList
public List queryForList ( String sql, Object [] args, int [] argTypes )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForList
public List queryForList ( String sql, Object [] args )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForLong
public long queryForLong ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForLong
public long queryForLong ( String sql, Object [] args, int [] argTypes )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForLong
public long queryForLong ( String sql, Object [] args )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForMap
public Map queryForMap ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForMap
public Map queryForMap ( String sql, Object [] args, int [] argTypes )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForMap
public Map queryForMap ( String sql, Object [] args )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForObject
public Object queryForObject ( String sql, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForObject
public Object queryForObject ( String sql, Class requiredType )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Class requiredType No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForObject
public Object queryForObject ( String sql, Object [] args, int [] argTypes, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForObject
public Object queryForObject ( String sql, Object [] args, RowMapper rowMapper )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
RowMapper rowMapper No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForObject
public Object queryForObject ( String sql, Object [] args, int [] argTypes, Class requiredType )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Class requiredType No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForObject
public Object queryForObject ( String sql, Object [] args, Class requiredType )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Class requiredType No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForRowSet
public SqlRowSet queryForRowSet ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForRowSet
public SqlRowSet queryForRowSet ( String sql, Object [] args, int [] argTypes )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
queryForRowSet
public SqlRowSet queryForRowSet ( String sql, Object [] args )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setFetchSize
public void setFetchSize ( int fetchSize )
Set the fetch size for this JdbcTemplate. This is important for processing large result sets: Setting this higher than the default value will increase processing speed at the cost of memory consumption; setting this lower can avoid transferring row data that will never be read by the application.

Default is 0, indicating to use the JDBC driver's default.

Parameters
TypeNameDescription
int fetchSize No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setIgnoreWarnings
public void setIgnoreWarnings ( boolean ignoreWarnings )
Set whether or not we want to ignore SQLWarnings. Default is "true".
Parameters
TypeNameDescription
boolean ignoreWarnings No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setMaxRows
public void setMaxRows ( int maxRows )
Set the maximum number of rows for this JdbcTemplate. This is important for processing subsets of large result sets, avoiding to read and hold the entire result set in the database or in the JDBC driver if we're never interested in the entire result in the first place (for example, when performing searches that might return a large number of matches).

Default is 0, indicating to use the JDBC driver's default.

Parameters
TypeNameDescription
int maxRows No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
setNativeJdbcExtractor
public void setNativeJdbcExtractor ( NativeJdbcExtractor extractor )
Set a NativeJdbcExtractor to extract native JDBC objects from wrapped handles. Useful if native Statement and/or ResultSet handles are expected for casting to database-specific implementation classes, but a connection pool that wraps JDBC objects is used (note: any pool will return wrapped Connections).
Parameters
TypeNameDescription
NativeJdbcExtractor extractor No description provided.
Returns void No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
public int update ( String sql )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
protected int update ( PreparedStatementCreator psc, PreparedStatementSetter pss )
No description provided.
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
PreparedStatementSetter pss No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
public int update ( PreparedStatementCreator psc )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
public int update ( PreparedStatementCreator psc, KeyHolder generatedKeyHolder )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
PreparedStatementCreator psc No description provided.
KeyHolder generatedKeyHolder No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
public int update ( String sql, PreparedStatementSetter pss )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
PreparedStatementSetter pss No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
public int update ( String sql, Object [] args, int [] argTypes )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
int[] argTypes No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.
update
public int update ( String sql, Object [] args )
No description provided.
Implements method in JdbcOperations
Parameters
TypeNameDescription
String sql No description provided.
Object [] args No description provided.
Exceptions
DataAccessException No description provided.
Wiki javadoc Use textile entry format.
Add your comments here.