Construct a new JdbcTemplate
, given a DataSource to obtain connections from.
Construct a new JdbcTemplate
, given a DataSource to obtain connections from.
the JDBC DataSource to obtain connections from
Creates a JdbcTemplate
that wraps the given Java template
Creates a JdbcTemplate
that wraps the given Java template
the Java JdbcTemplate
to wrap
Execute multiple batches using the supplied SQL statement with the collect of supplied arguments.
Execute multiple batches using the supplied SQL statement with the collect of supplied arguments. The arguments' values will be set using the function. Each batch should be of size indicated in 'batchSize'.
the SQL statement to execute.
the Seq of Object sequences containing the batch of arguments for the query
the batch size
function to set parameters on the PreparedStatement created by this method
an array containing for each batch another array containing the numbers of rows affected by each update in the batch
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
the SQL statement to execute.
the Seq of Object sequences containing the batch of arguments for the query
SQL types of the arguments (constants from java.sql.Types)
an sequence containing the numbers of rows affected by each update in the batch
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
the SQL statement to execute
the Seq of Object sequences containing the batch of arguments for the query
an sequence containing the numbers of rows affected by each update in the batch
Issue multiple update statements on a single PreparedStatement, using batch updates and a function to set values.
Issue multiple update statements on a single PreparedStatement, using batch updates and a function to set values.
Will fall back to separate updates on a single PreparedStatement if the JDBC driver does not support batch updates.
defining PreparedStatement that will be reused. All statements in the batch will use the same SQL.
the size of the batch
function to set parameters on the PreparedStatement created by this method
an sequence of the number of rows affected by each statement
DataAccessException
if there is any problem issuing the update
Issue multiple SQL updates on a single JDBC Statement using batching.
Issue multiple SQL updates on a single JDBC Statement using batching.
Will fall back to separate updates on a single Statement if the JDBC driver does not support batch updates.
defining an array of SQL statements that will be executed.
an array of the number of rows affected by each statement
DataAccessException
if there is any problem executing the batch
Execute a SQL call using a function to provide SQL and any required parameters.
Execute a SQL call using a function to provide SQL and any required parameters.
object that provides SQL and any necessary parameters
declared SqlParameter objects
Map of extracted out parameters
DataAccessException
if there is any problem issuing the update
Issue a single SQL execute, typically a DDL statement.
Issue a single SQL execute, typically a DDL statement.
static SQL to execute
DataAccessException
if there is any problem
Execute a JDBC data access operation, implemented as function working on a JDBC CallableStatement.
Execute a JDBC data access operation, implemented as function working on a JDBC CallableStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.
The function can return a result object, for example a domain object or a collection of domain objects.
the SQL call string to execute
function that specifies the action
a result object returned by the action, or null
DataAccessException
if there is any problem
Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.CallableStatement.
Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.CallableStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.
The function can return a result object, for example a domain object or a collection of domain objects.
function that can create a CallableStatement given a Connection
function that specifies the action
a result object returned by the action, or null
DataAccessException
if there is any problem
Execute a JDBC data access operation, implemented as function working on a JDBC Connection.
Execute a JDBC data access operation, implemented as function working on a JDBC Connection. This allows for implementing arbitrary data access operations, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.
The callback function can return a result object, for example a domain object or a collection of domain objects.
the function that specifies the action
a result object returned by the action, or null
DataAccessException
if there is any problem
Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.PreparedStatement.
Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.PreparedStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.
The function can return a result object, for example a domain object or a collection of domain objects.
SQL to execute
function that specifies the action
a result object returned by the function, or null
DataAccessException
if there is any problem
Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.PreparedStatement.
Execute a JDBC data access operation, implemented as function working on a JDBC java.sql.PreparedStatement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.
The function can return a result object, for example a domain object or a collection of domain objects.
function that can create a PreparedStatement given a Connection
function that specifies the action
a result object returned by the function, or null
DataAccessException
if there is any problem
Execute a JDBC data access operation, implemented as function working on a JDBC Statement.
Execute a JDBC data access operation, implemented as function working on a JDBC Statement. This allows for implementing arbitrary data access operations on a single Statement, within Spring's managed JDBC environment: that is, participating in Spring-managed transactions and converting JDBC SQLExceptions into Spring's DataAccessException hierarchy.
The callback action can return a result object, for example a domain object or a collection of domain objects.
function that specifies the action
a result object returned by the action, or null
DataAccessException
if there is any problem
the Java JdbcTemplate
to wrap
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.
SQL query to execute
arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type); may also contain org.springframework.jdbc.core.SqlParameterValue objects which indicate not only the argument value but also the SQL type and optionally the scale
function that will extract results
an arbitrary result object, as returned by the function
DataAccessException
if the query fails
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet with a function.
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
function that will extract results
an arbitrary result object, as returned by the function
DataAccessException
if the query fails
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
Query using a prepared statement, reading the ResultSet with a ResultSetExtractor.
function that can create a PreparedStatement given a Connection
function that will extract results
an arbitrary result object, as returned by the function
DataAccessException
if there is any problem
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.
SQL query to execute
arguments to bind to the query
function that will map one object per row
the result Seq, containing mapped objects
DataAccessException
if the query fails
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping each row to a Java object via a function.
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
function that will map one object per row
the result Seq, containing mapped objects
DataAccessException
if the query fails
Query using a prepared statement, mapping each row to a Java object via a function.
Query using a prepared statement, mapping each row to a Java object via a function.
function that can create a PreparedStatement given a Connection
function that will map one object per row
the result Seq, containing mapped objects
DataAccessException
if there is any problem
Execute a query given static SQL, mapping each row to a Java object via a RowMapper.
Execute a query given static SQL, mapping each row to a Java object via a RowMapper.
SQL query to execute
function that will map one object per row
the result List, containing mapped objects
DataAccessException
if there is any problem executing the query
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.
SQL query to execute
arguments to bind to the query
function that will extract results, one row at a time
DataAccessException
if the query fails
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, reading the ResultSet on a per-row basis with a function.
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
function that will extract results, one row at a time
DataAccessException
if the query fails
Query using a prepared statement, reading the ResultSet on a per-row basis with a function.
Query using a prepared statement, reading the ResultSet on a per-row basis with a function.
function that can create a PreparedStatement given a Connection
function that will extract results, one row at a time
DataAccessException
if there is any problem
Execute a query given static SQL, reading the ResultSet on a per-row basis with a function.
Execute a query given static SQL, reading the ResultSet on a per-row basis with a function.
SQL query to execute
function that will extract results, one row at a time
DataAccessException
if there is any problem executing the query
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result Map.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result Map.
The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
SQL query to execute
arguments to bind to the query
the result Map (one entry for each column, using the column name as the key)
DataAccessException
if the query fails
IncorrectResultSizeDataAccessException
if the query does not
return exactly one row
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result Map.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result Map.
The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
the result Map (one entry for each column, using the column name as the key)
DataAccessException
if the query fails
IncorrectResultSizeDataAccessException
if the query does not
return exactly one row
Execute a query for a result Map, given static SQL.
Execute a query for a result Map, given static SQL.
The query is expected to be a single row query; the result row will be mapped to a Map (one entry for each column, using the column name as the key).
SQL query to execute
the result Map (one entry for each column, using the column name as the key)
DataAccessException
if there is any problem executing the query
IncorrectResultSizeDataAccessException
if the query does not
return exactly one row
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
The results will be mapped to a Seq (one entry for each row) of Maps (one entry for each column, using the column name as the key). Each element in the list will be of the form returned by this interface's queryForMap() methods.
SQL query to execute
arguments to bind to the query
a Seq that contains a Map per row
DataAccessException
if the query fails
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
The results will be mapped to a Seq (one entry for each row) of Maps (one entry for each column, using the column name as the key). Thus each element in the list will be of the form returned by this interface's queryForMap() methods.
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
a Seq that contains a Map per row
DataAccessException
if the query fails
Execute a query for a result list, given static SQL.
Execute a query for a result list, given static SQL.
The results will be mapped to a Seq (one entry for each row) of Maps (one entry for each column using the column name as the key). Each element in the list will be of the form returned by this class's queryForMap() method.
SQL query to execute
an Seq that contains a Map per row
DataAccessException
if there is any problem executing the query
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result object.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result object.
The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
the type that the result object is expected to match
SQL query to execute
arguments to bind to the query
an option value containing the result object of the required type, or None
in case of SQL NULL
DataAccessException
if the query fails
IncorrectResultSizeDataAccessException
if the query does not return
exactly one row, or does not return
exactly one column in that row
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result object.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result object.
The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
the type that the result object is expected to match
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
an option value containing the result object of the required type, or None
in case of SQL NULL
DataAccessException
if the query fails
IncorrectResultSizeDataAccessException
if the query does not return
exactly one row, or does not return
exactly one column in that row
Execute a query for a result object, given static SQL.
Execute a query for a result object, given static SQL.
This method is useful for running static SQL with a known outcome. The query is expected to be a single row/single column query; the returned result will be directly mapped to the corresponding object type.
SQL query to execute
an option value containing the result object of the required type, or None
in case of SQL NULL
DataAccessException
if there is any problem executing the query
IncorrectResultSizeDataAccessException
if the query does not return exactly
one row, or does not return exactly
one column in that row
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.
SQL query to execute
arguments to bind to the query
function that will map one object per row
an option value containing the single mapped object; or None
DataAccessException
if the query fails
IncorrectResultSizeDataAccessException
if the query does not
return exactly one row
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, mapping a single result row to a Java object via a function.
SQL query to execute
arguments to bind to the query (leaving it to the PreparedStatement to guess the corresponding SQL type)
SQL types of the arguments (constants from java.sql.Types)
object that will map one object per row
an option value containing the single mapped object; or None
DataAccessException
if the query fails
IncorrectResultSizeDataAccessException
if the query does not
return exactly one row
Execute a query given static SQL, mapping a single result row to a Java object via a row mapping function.
Execute a query given static SQL, mapping a single result row to a Java object via a row mapping function.
SQL query to execute
function that will map one object per row
the single mapped object
DataAccessException
if there is any problem executing the query
IncorrectResultSizeDataAccessException
if the query does not
return exactly one row
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a SqlRowSet.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a SqlRowSet.
The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.
SQL query to execute
arguments to bind to the query
a SqlRowSet representation
DataAccessException
if there is any problem executing the query
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a SqlRowSet.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a SqlRowSet.
The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
a SqlRowSet representation
DataAccessException
if there is any problem executing the query
Execute a query for a SqlRowSet, given static SQL.
Execute a query for a SqlRowSet, given static SQL.
The results will be mapped to an SqlRowSet which holds the data in a disconnected fashion. This wrapper will translate any SQLExceptions thrown.
SQL query to execute
a SqlRowSet representation
DataAccessException
if there is any problem executing the query
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
The results will be mapped to a Seq (one entry for each row) of result objects, each of them matching the specified element type.
the required type of element in the result list
SQL query to execute
arguments to bind to the query
a Seq of objects that match the specified element type
DataAccessException
if the query fails
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
Query given SQL to create a prepared statement from SQL and a sequence of arguments to bind to the query, expecting a result sequence.
The results will be mapped to a Seq (one entry for each row) of result objects, each of them matching the specified element type.
the required type of element in the result list
SQL query to execute
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
a Seq of objects that match the specified element type
DataAccessException
if the query fails
Execute a query for a result sequence, given static SQL.
Execute a query for a result sequence, given static SQL.
The results will be mapped to a Seq (one entry for each row) of result objects, each of them matching the specified element type.
the required type of element in the result list
SQL query to execute
a Seq of objects that match the specified element type
DataAccessException
if there is any problem executing the query
Query using a prepared statement, reading the ResultSet with a function.
Query using a prepared statement, reading the ResultSet with a function.
SQL query to execute
function that knows how to set values on the prepared statement.
function that will extract results
an arbitrary result object, as returned by the function
DataAccessException
if there is any problem
Query given SQL to create a prepared statement from SQL and a function implementation that knows how to bind values to the query, mapping each row to a Java object via a function.
Query given SQL to create a prepared statement from SQL and a function implementation that knows how to bind values to the query, mapping each row to a Java object via a function.
SQL query to execute
function that knows how to set values on the prepared statement
function that will map one object per row
the result Seq, containing mapped objects
DataAccessException
if the query fails
Query given SQL to create a prepared statement from SQL and a function that knows how to bind values to the query, reading the ResultSet on a per-row basis with another function.
Query given SQL to create a prepared statement from SQL and a function that knows how to bind values to the query, reading the ResultSet on a per-row basis with another function.
SQL query to execute
function that knows how to set values on the prepared statement.
function that will extract results, one row at a time
DataAccessException
if the query fails
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.
SQL containing bind parameters
arguments to bind to the query
the number of rows affected
DataAccessException
if there is any problem issuing the update
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.
Issue a single SQL update operation (such as an insert, update or delete statement) via a prepared statement, binding the given arguments.
SQL containing bind parameters
arguments to bind to the query
SQL types of the arguments (constants from java.sql.Types)
the number of rows affected
DataAccessException
if there is any problem issuing the update
Issue an update statement using a function to provide SQL and any required parameters.
Issue an update statement using a function to provide SQL and any required parameters. Generated keys will be put into the given KeyHolder.
Note that the given PreparedStatementCreator has to create a statement with activated extraction of generated keys (a JDBC 3.0 feature). This can either be done directly or through using a PreparedStatementCreatorFactory.
KeyHolder that will hold the generated keys
object that provides SQL and any necessary parameters
the number of rows affected
DataAccessException
if there is any problem issuing the update
Issue a single SQL update operation (such as an insert, update or delete statement) using a function to provide SQL and any required parameters.
Issue a single SQL update operation (such as an insert, update or delete statement) using a function to provide SQL and any required parameters.
function that provides SQL and any necessary parameters
the number of rows affected
DataAccessException
if there is any problem issuing the update
Issue a single SQL update operation (such as an insert, update or delete statement).
Issue a single SQL update operation (such as an insert, update or delete statement).
static SQL to execute
the number of rows affected
DataAccessException
if there is any problem.
Issue an update statement using a function to set bind parameters, with given SQL.
Issue an update statement using a function to set bind parameters, with given SQL.
SQL containing bind parameters
helper function that sets bind parameters. If this is
null
} we run an update with static SQL.
the number of rows affected
DataAccessException
if there is any problem issuing the update
Scala-based convenience wrapper for the Spring org.springframework.jdbc.core.JdbcTemplate, taking advantage of functions and Scala types, and exposing only the most commonly required operations in order to simplify JdbcTemplate usage.
Use the
javaTemplate
accessor to get access to the JavaJdbcTemplate
.1.0