org.springframework.jdbc.core.simple.JdbcClient as of 6.1.
This class 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 common org.springframework.dao exception hierarchy.
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, providing SQL and
any necessary parameters. The ResultSetExtractor interface extracts
values from a ResultSet. See also PreparedStatementSetter and
RowMapper for two popular alternative callback interfaces.
An instance of this template class is thread-safe once configured. 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.
Because this class is parameterizable by the callback interfaces and
the org.
interface, there should be no need to subclass it.
All SQL operations performed by this class are logged at debug level, using "org.springframework.jdbc.core.JdbcTemplate" as log category.
NOTE: As of 6.1, there is a unified JDBC access facade available in
the form of org..
JdbcClient provides a fluent API style for common JDBC queries/updates
with flexible use of indexed or named parameters. It delegates to a
JdbcTemplate/NamedParameterJdbcTemplate for actual execution.
JdbcOperations, PreparedStatementCreator, PreparedStatementSetter, CallableStatementCreator, PreparedStatementCallback, CallableStatementCallback, ResultSetExtractor, RowCallbackHandler, RowMapper, org.springframework.jdbc.support.SQLExceptionTranslator , org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
| Modifier and Type | Class and Description |
|---|---|
| private class | JdbcTemplate.
Invocation handler that suppresses close calls on JDBC Connections. |
| private static class | JdbcTemplate.
Spliterator for queryForStream adaptation of a ResultSet to a Stream. |
| private static class | JdbcTemplate.
Adapter to enable use of a RowCallbackHandler inside a ResultSetExtractor. |
| private static class | JdbcTemplate.
Simple adapter for CallableStatementCreator, allowing to use a plain SQL statement. |
| private static class | JdbcTemplate.
Simple adapter for PreparedStatementCreator, allowing to use a plain SQL statement. |
| Modifier and Type | Field and Description |
|---|---|
| private int | fetchSize
If this variable is set to a non-negative value, it will be used for setting the fetchSize property on statements used for query processing. |
| private boolean | ignoreWarnings
If this variable is |
| private int | maxRows
If this variable is set to a non-negative value, it will be used for setting the maxRows property on statements used for query processing. |
| private int | queryTimeout
If this variable is set to a non-negative value, it will be used for setting the queryTimeout property on statements used for query processing. |
| private boolean | resultsMapCaseInsensitive
If this variable is set to true then execution of a CallableStatement will return the results in a Map that uses case-insensitive names for the parameters. |
| private static final String | |
| private static final String | |
| private boolean | skipResultsProcessing
If this variable is set to true, then all results checking will be bypassed for any callable statement processing. |
| private boolean | skipUndeclaredResults
If this variable is set to true then all results from a stored procedure call that don't have a corresponding SqlOutParameter declaration will be bypassed. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | JdbcTemplate(DataSource
the JDBC DataSource to obtain connections from dataSource)Construct a new JdbcTemplate, given a DataSource to obtain connections from. |
| public | JdbcTemplate(DataSource
the JDBC DataSource to obtain connections from dataSource, boolean whether to lazily initialize the SQLExceptionTranslator lazyInit)Construct a new JdbcTemplate, given a DataSource to obtain connections from. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | applyStatementSettings(Statement
the JDBC Statement to prepare stmt)Prepare the given JDBC Statement (or PreparedStatement or CallableStatement), applying statement settings such as fetch size, max rows, and query timeout. |
| public int[] | batchUpdate(final String...
defining an array of SQL statements that will be executed. sql)Implements org. Issue multiple SQL updates on a single JDBC Statement using batching. |
| public int[] | batchUpdate(final PreparedStatementCreator
a callback that creates a PreparedStatement given a Connection psc, final BatchPreparedStatementSetter object to set parameters on the PreparedStatement
created by this method pss, final KeyHolder a KeyHolder that will hold the generated keys generatedKeyHolder)Implements org. Issue multiple update statements on a single PreparedStatement, using batch updates and a BatchPreparedStatementSetter to set values. |
| public int[] | batchUpdate(String
defining PreparedStatement that will be reused.
All statements in the batch will use the same SQL. sql, final BatchPreparedStatementSetter object to set parameters on the PreparedStatement
created by this method pss)Implements org. Issue multiple update statements on a single PreparedStatement, using batch updates and a BatchPreparedStatementSetter to set values. |
| public int[] | batchUpdate(String
the SQL statement to execute sql, List<Object[]> the List of Object arrays containing the batch of arguments for the query batchArgs)Implements org. Execute a batch using the supplied SQL statement with the batch of supplied arguments. |
| public int[] | batchUpdate(String
the SQL statement to execute. sql, List<Object[]> the List of Object arrays containing the batch of arguments for the query batchArgs, final int[] the SQL types of the arguments
(constants from argTypes)java.sql.Types)Implements org. Execute a batch using the supplied SQL statement with the batch of supplied arguments. |
| public <T> int[][] | batchUpdate(String
the SQL statement to execute. sql, final Collection<T> the List of Object arrays containing the batch of arguments for the query batchArgs, final int batch size batchSize, final ParameterizedPreparedStatementSetter<T> the ParameterizedPreparedStatementSetter to use pss)Implements org. Execute multiple batches using the supplied SQL statement with the collect of supplied arguments. |
| public Map | call(CallableStatementCreator
a callback that provides SQL and any necessary parameters csc, List<SqlParameter> list of declared SqlParameter objects declaredParameters)Implements org. Execute an SQL call using a CallableStatementCreator to provide SQL and any required parameters. |
| protected Connection | Returns: the Connection proxythe JDBC Connection to create a proxy for con)Create a close-suppressing proxy for the given JDBC Connection. |
| protected Map | Returns: the results Map instanceCreate a Map instance to be used as the results map. |
| public <T> T | execute(ConnectionCallback<T>
a callback object that specifies the action action)Implements org. Execute a JDBC data access operation, implemented as callback action working on a JDBC Connection. |
| private <T> T | |
| public <T> T | execute(StatementCallback<T>
a callback that specifies the action action)Implements org. Execute a JDBC data access operation, implemented as callback action working on a JDBC Statement. |
| public void | execute(final String
static SQL to execute sql)Implements org. Issue a single SQL execute, typically a DDL statement. |
| private <T> T | |
| public <T> T | execute(PreparedStatementCreator
a callback that creates a PreparedStatement given a Connection psc, PreparedStatementCallback<T> a callback that specifies the action action)Implements org. Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement. |
| public <T> T | execute(String
the SQL to execute sql, PreparedStatementCallback<T> a callback that specifies the action action)Implements org. Execute a JDBC data access operation, implemented as callback action working on a JDBC PreparedStatement. |
| public <T> T | execute(CallableStatementCreator
a callback that creates a CallableStatement given a Connection csc, CallableStatementCallback<T> a callback that specifies the action action)Implements org. Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement. |
| public <T> T | execute(String
the SQL call string to execute callString, CallableStatementCallback<T> a callback that specifies the action action)Implements org. Execute a JDBC data access operation, implemented as callback action working on a JDBC CallableStatement. |
| protected Map | Returns: a Map that contains returned resultsthe JDBC wrapper for the stored procedure cs, List<SqlParameter> parameter list for the stored procedure parameters)Extract output parameters from the completed stored procedure. |
| protected Map | Returns: a Map that contains returned resultsa JDBC wrapper for the stored procedure cs, List<SqlParameter> the parameter list of declared update count parameters for the stored procedure updateCountParameters, List<SqlParameter> the parameter list of declared resultSet parameters for the stored procedure resultSetParameters, int updateCount)Extract returned ResultSets from the completed stored procedure. |
| protected RowMapper | Returns: the RowMapper to useCreate a new RowMapper for reading columns as key-value pairs. |
| public int | |
| public int | |
| private PreparedStatementCallback | |
| public int | |
| protected <T> RowMapper | Returns: the RowMapper to usethe type that each result object is expected to match requiredType)Create a new RowMapper for reading result objects from a single column. |
| private static String | |
| protected void | handleWarnings(Statement
the current JDBC statement stmt, SQLException the primary exception after failed statement execution ex)Handle warnings before propagating a primary |
| protected void | handleWarnings(Statement
the current JDBC statement stmt)Handle the warnings for the given JDBC statement, if any. |
| protected void | handleWarnings(SQLWarning
the warnings object from the current statement.
May be warning)null, in which case this method does nothing.Throw a |
| public boolean | |
| public boolean | isResultsMapCaseInsensitive()
Return whether execution of a CallableStatement will return the results in a Map that uses case-insensitive names for the parameters. |
| public boolean | |
| public boolean | |
| protected PreparedStatementSetter | Returns: the new PreparedStatementSetter to useobject array with arguments args)Create a new arg-based PreparedStatementSetter using the args passed in. By default, we'll create an |
| protected PreparedStatementSetter | Returns: the new PreparedStatementSetter to useobject array with arguments args, int[] int array of SQLTypes for the associated arguments argTypes)Create a new arg-type-based PreparedStatementSetter using the args and types passed in. By default, we'll create an |
| protected Map | Returns: a Map that contains returned resultsthe ResultSet to process rs, ResultSetSupportingSqlParameter the corresponding stored procedure parameter param)Process the given ResultSet from a stored procedure. |
| public <T> T | query(final String
the SQL query to execute sql, final ResultSetExtractor<T> a callback that will extract all rows of results rse)Implements org. Execute a query given static SQL, reading the ResultSet with a ResultSetExtractor. |
| public void | query(String
the SQL query to execute sql, RowCallbackHandler a callback that will extract results, one row at a time rch)Implements org. Execute a query given static SQL, reading the ResultSet on a per-row basis with a RowCallbackHandler. |
| public <T> List | query(String
the SQL query to execute sql, RowMapper<T> a callback that will map one object per row rowMapper)Implements org. Execute a query given static SQL, mapping each row to a result object via a RowMapper. |
| public <T> T | Returns: an arbitrary result object, as returned by the ResultSetExtractora callback that creates a PreparedStatement given a Connection psc, final PreparedStatementSetter a callback that knows how to set values on the prepared statement.
If this is pss, final ResultSetExtractor<T> null, the SQL will be assumed to contain no bind parameters.a callback that will extract results rse)Query using a prepared statement, allowing for a PreparedStatementCreator and a PreparedStatementSetter. |
| public <T> T | query(PreparedStatementCreator
a callback that creates a PreparedStatement given a Connection psc, ResultSetExtractor<T> a callback that will extract results rse)Implements org. Query using a prepared statement, reading the ResultSet with a ResultSetExtractor. |
| public <T> T | query(String
the SQL query to execute sql, PreparedStatementSetter a callback that knows how to set values on the prepared statement.
If this is pss, ResultSetExtractor<T> null, the SQL will be assumed to contain no bind parameters.
Even if there are no bind parameters, this callback may be used to set the
fetch size and other performance options.a callback that will extract results rse)Implements org. Query using a prepared statement, reading the ResultSet with a ResultSetExtractor. |
| public <T> T | query(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes, ResultSetExtractor<T> java.sql.Types)a callback that will extract results rse)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor. |
| public <T> T | query(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args, ResultSetExtractor<T> SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scalea callback that will extract results rse)Implements org.
Deprecated
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor. |
| public <T> T | query(String
the SQL query to execute sql, ResultSetExtractor<T> a callback that will extract results rse, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet with a ResultSetExtractor. |
| public void | query(PreparedStatementCreator
a callback that creates a PreparedStatement given a Connection psc, RowCallbackHandler a callback that will extract results, one row at a time rch)Implements org. Query using a prepared statement, reading the ResultSet on a per-row basis with a RowCallbackHandler. |
| public void | query(String
the SQL query to execute sql, PreparedStatementSetter a callback that knows how to set values on the prepared statement.
If this is pss, RowCallbackHandler null, the SQL will be assumed to contain no bind parameters.
Even if there are no bind parameters, this callback may be used to set the
fetch size and other performance options.a callback that will extract results, one row at a time rch)Implements org. Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler. |
| public void | query(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes, RowCallbackHandler java.sql.Types)a callback that will extract results, one row at a time rch)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler. |
| public void | query(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args, RowCallbackHandler SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scalea callback that will extract results, one row at a time rch)Implements org.
Deprecated
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler. |
| public void | query(String
the SQL query to execute sql, RowCallbackHandler a callback that will extract results, one row at a time rch, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, reading the ResultSet on a per-row basis with a RowCallbackHandler. |
| public <T> List | query(PreparedStatementCreator
a callback that creates a PreparedStatement given a Connection psc, RowMapper<T> a callback that will map one object per row rowMapper)Implements org. Query using a prepared statement, mapping each row to a result object via a RowMapper. |
| public <T> List | query(String
the SQL query to execute sql, PreparedStatementSetter a callback that knows how to set values on the prepared statement.
If this is pss, RowMapper<T> null, the SQL will be assumed to contain no bind parameters.
Even if there are no bind parameters, this callback may be used to set the
fetch size and other performance options.a callback that will map one object per row rowMapper)Implements org. Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a result object via a RowMapper. |
| public <T> List | query(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes, RowMapper<T> java.sql.Types)a callback that will map one object per row rowMapper)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper. |
| public <T> List | query(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args, RowMapper<T> SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scalea callback that will map one object per row rowMapper)Implements org.
Deprecated
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper. |
| public <T> List | query(String
the SQL query to execute sql, RowMapper<T> a callback that will map one object per row rowMapper, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper. |
| public <T> List | queryForList(String
the SQL query to execute sql, Class<T> the required type of element in the result list
(for example, elementType)Integer.class)Implements org. Execute a query for a result list, given static SQL. |
| public List | queryForList(String
the SQL query to execute sql)Implements org. Execute a query for a result list, given static SQL. |
| public <T> List | queryForList(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes, Class<T> java.sql.Types)the required type of element in the result list
(for example, elementType)Integer.class)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
| public <T> List | queryForList(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args, Class<T> SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scalethe required type of element in the result list
(for example, elementType)Integer.class)Implements org.
Deprecated
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
| public <T> List | queryForList(String
the SQL query to execute sql, Class<T> the required type of element in the result list
(for example, elementType, Object... Integer.class)arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
| public List | queryForList(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes)java.sql.Types)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
| public List | queryForList(String
the SQL query to execute sql, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result list. |
| public Map | queryForMap(String
the SQL query to execute sql)Implements org. Execute a query for a result map, given static SQL. |
| public Map | queryForMap(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes)java.sql.Types)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result map. |
| public Map | queryForMap(String
the SQL query to execute sql, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result map. |
| public <T> T | queryForObject(String
the SQL query to execute sql, RowMapper<T> a callback that will map one object per row rowMapper)Implements org. Execute a query given static SQL, mapping a single result row to a result object via a RowMapper. |
| public <T> T | queryForObject(String
the SQL query to execute sql, Class<T> the type that the result object is expected to match requiredType)Implements org. Execute a query for a result object, given static SQL. |
| public <T> T | queryForObject(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type) args, int[] the SQL types of the arguments
(constants from argTypes, RowMapper<T> java.sql.Types)a callback that will map one object per row rowMapper)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper. |
| public <T> T | queryForObject(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args, RowMapper<T> SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scalea callback that will map one object per row rowMapper)Implements org.
Deprecated
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper. |
| public <T> T | queryForObject(String
the SQL query to execute sql, RowMapper<T> a callback that will map one object per row rowMapper, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping a single result row to a result object via a RowMapper. |
| public <T> T | queryForObject(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes, Class<T> java.sql.Types)the type that the result object is expected to match requiredType)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object. |
| public <T> T | queryForObject(String
the SQL query to execute sql, Object[] arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args, Class<T> SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scalethe type that the result object is expected to match requiredType)Implements org.
Deprecated
Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object. |
| public <T> T | queryForObject(String
the SQL query to execute sql, Class<T> the type that the result object is expected to match requiredType, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting a result object. |
| public SqlRowSet | queryForRowSet(String
the SQL query to execute sql)Implements org. Execute a query for an SqlRowSet, given static SQL. |
| public SqlRowSet | queryForRowSet(String
the SQL query to execute sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes)java.sql.Types)Implements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting an SqlRowSet. |
| public SqlRowSet | queryForRowSet(String
the SQL query to execute sql, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, expecting an SqlRowSet. |
| public <T> Stream | queryForStream(String
the SQL query to execute sql, RowMapper<T> a callback that will map one object per row rowMapper)Implements org. Execute a query given static SQL, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream. |
| public <T> Stream | Returns: the result Stream, containing mapped objects, needing to be closed once fully processed (e.g. through a try-with-resources clause)a callback that creates a PreparedStatement given a Connection psc, PreparedStatementSetter a callback that knows how to set values on the prepared statement.
If this is pss, RowMapper<T> null, the SQL will be assumed to contain no bind parameters.a callback that will map one object per row rowMapper)Query using a prepared statement, allowing for a PreparedStatementCreator and a PreparedStatementSetter. |
| public <T> Stream | queryForStream(PreparedStatementCreator
a callback that creates a PreparedStatement given a Connection psc, RowMapper<T> a callback that will map one object per row rowMapper)Implements org. Query using a prepared statement, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream. |
| public <T> Stream | queryForStream(String
the SQL query to execute sql, PreparedStatementSetter a callback that knows how to set values on the prepared statement.
If this is pss, RowMapper<T> null, the SQL will be assumed to contain no bind parameters.
Even if there are no bind parameters, this callback may be used to set the
fetch size and other performance options.a callback that will map one object per row rowMapper)Implements org. Query given SQL to create a prepared statement from SQL and a PreparedStatementSetter implementation that knows how to bind values to the query, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream. |
| public <T> Stream | queryForStream(String
the SQL query to execute sql, RowMapper<T> a callback that will map one object per row rowMapper, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Query given SQL to create a prepared statement from SQL and a list of arguments to bind to the query, mapping each row to a result object via a RowMapper, and turning it into an iterable and closeable Stream. |
| private static <T> T | |
| public void | |
| public void | setIgnoreWarnings(boolean ignoreWarnings)
Set whether we want to ignore JDBC statement warnings ( |
| public void | |
| public void | setQueryTimeout(int queryTimeout)
Set the query timeout for statements that this JdbcTemplate executes. |
| public void | setResultsMapCaseInsensitive(boolean resultsMapCaseInsensitive)
Set whether execution of a CallableStatement will return the results in a Map that uses case-insensitive names for the parameters. |
| public void | setSkipResultsProcessing(boolean skipResultsProcessing)
Set whether results processing should be skipped. |
| public void | setSkipUndeclaredResults(boolean skipUndeclaredResults)
Set whether undeclared results should be skipped. |
| private void | |
| protected DataAccessException | Returns: a DataAccessException wrapping theSQLException (never null)readable text describing the task being attempted task, String the SQL query or update that caused the problem (may be sql, SQLException null)the offending ex)SQLExceptionTranslate the given |
| public int | update(final String
static SQL to execute sql)Implements org. Issue a single SQL update operation (such as an insert, update or delete statement). |
| protected int | |
| public int | update(PreparedStatementCreator
a callback that provides SQL and any necessary parameters psc)Implements org. Issue a single SQL update operation (such as an insert, update or delete statement) using a PreparedStatementCreator to provide SQL and any required parameters. |
| public int | update(final PreparedStatementCreator
a callback that provides SQL and any necessary parameters psc, final KeyHolder a KeyHolder that will hold the generated keys generatedKeyHolder)Implements org. Issue an update statement using a PreparedStatementCreator to provide SQL and any required parameters. |
| public int | update(String
the SQL containing bind parameters sql, PreparedStatementSetter helper that sets bind parameters. If this is pss)null
we run an update with static SQL.Implements org. Issue an update statement using a PreparedStatementSetter to set bind parameters, with given SQL. |
| public int | update(String
the SQL containing bind parameters sql, Object[] arguments to bind to the query args, int[] the SQL types of the arguments
(constants from argTypes)java.sql.Types)Implements org. Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments. |
| public int | update(String
the SQL containing bind parameters sql, Object... arguments to bind to the query
(leaving it to the PreparedStatement to guess the corresponding SQL type);
may also contain args)SqlParameterValue objects which indicate not
only the argument value but also the SQL type and optionally the scaleImplements org. Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments. |
| private static int |