public interface

SimpleJdbcOperations

org.springframework.jdbc.core.simple.SimpleJdbcOperations
Known Indirect Subclasses

Class Overview

JDBC operations interface usable on Java 5 and above, exposing a set of common JDBC operations, whose interface is simplified through the use of varargs and autoboxing.

Summary

Public Methods
abstract int[] batchUpdate(String sql, SqlParameterSource[] batchArgs)
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
abstract int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes)
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
abstract int[] batchUpdate(String sql, Map[]<String, ?> batchValues)
Executes a batch using the supplied SQL statement with the batch of supplied arguments.
abstract int[] batchUpdate(String sql, List<Object[]> batchArgs)
Execute a batch using the supplied SQL statement with the batch of supplied arguments.
abstract JdbcOperations getJdbcOperations()
Expose the classic Spring JdbcTemplate to allow invocation of less commonly used methods.
abstract NamedParameterJdbcOperations getNamedParameterJdbcOperations()
Expose the Spring NamedParameterJdbcTemplate to allow invocation of less commonly used methods.
abstract <T> List<T> query(String sql, ParameterizedRowMapper<T> rm, Object... args)
This method is deprecated. as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.
abstract <T> List<T> query(String sql, RowMapper<T> rm, SqlParameterSource args)
Query for a List of Objects of type T using the supplied RowMapper to the query results to the object.
abstract <T> List<T> query(String sql, RowMapper<T> rm, Map<String, ?> args)
Query for a List of Objects of type T using the supplied RowMapper to the query results to the object.
abstract <T> List<T> query(String sql, RowMapper<T> rm, Object... args)
Query for a List of Objects of type T using the supplied RowMapper to the query results to the object.
abstract <T> List<T> query(String sql, ParameterizedRowMapper<T> rm, Map<String, ?> args)
This method is deprecated. as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.
abstract <T> List<T> query(String sql, ParameterizedRowMapper<T> rm, SqlParameterSource args)
This method is deprecated. as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.
abstract int queryForInt(String sql, SqlParameterSource args)
Query for an int passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a SqlParameterSource containing the arguments.
abstract int queryForInt(String sql, Map<String, ?> args)
Query for an int passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a map containing the arguments.
abstract int queryForInt(String sql, Object... args)
Query for an int passing in a SQL query using the standard '?' placeholders for parameters and a variable number of arguments.
abstract List<Map<StringObject>> queryForList(String sql, SqlParameterSource args)
Execute the supplied query with the supplied arguments.
abstract List<Map<StringObject>> queryForList(String sql, Map<String, ?> args)
Execute the supplied query with the supplied arguments.
abstract List<Map<StringObject>> queryForList(String sql, Object... args)
Execute the supplied query with the (optional) supplied arguments.
abstract long queryForLong(String sql, SqlParameterSource args)
Query for an long passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a SqlParameterSource containing the arguments.
abstract long queryForLong(String sql, Map<String, ?> args)
Query for an long passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a map containing the arguments.
abstract long queryForLong(String sql, Object... args)
Query for an long passing in a SQL query using the standard '?' placeholders for parameters and a variable number of arguments.
abstract Map<StringObject> queryForMap(String sql, Object... args)
Execute the supplied query with the (optional) supplied arguments.
abstract Map<StringObject> queryForMap(String sql, SqlParameterSource args)
Execute the supplied query with the supplied arguments.
abstract Map<StringObject> queryForMap(String sql, Map<String, ?> args)
Execute the supplied query with the supplied arguments.
abstract <T> T queryForObject(String sql, Class<T> requiredType, Map<String, ?> args)
Query for an object of type T identified by the supplied @Class.
abstract <T> T queryForObject(String sql, RowMapper<T> rm, Object... args)
Query for an object of type T using the supplied RowMapper to the query results to the object.
abstract <T> T queryForObject(String sql, RowMapper<T> rm, SqlParameterSource args)
Query for an object of type T using the supplied RowMapper to the query results to the object.
abstract <T> T queryForObject(String sql, Class<T> requiredType, Object... args)
Query for an object of type T identified by the supplied @Class.
abstract <T> T queryForObject(String sql, Class<T> requiredType, SqlParameterSource args)
Query for an object of type T identified by the supplied @Class.
abstract <T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, SqlParameterSource args)
This method is deprecated. as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.
abstract <T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, Object... args)
This method is deprecated. as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.
abstract <T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, Map<String, ?> args)
This method is deprecated. as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.
abstract <T> T queryForObject(String sql, RowMapper<T> rm, Map<String, ?> args)
Query for an object of type T using the supplied RowMapper to the query results to the object.
abstract int update(String sql, Map<String, ?> args)
Execute the supplied SQL statement with (optional) supplied arguments.
abstract int update(String sql, Object... args)
Execute the supplied SQL statement with supplied arguments.
abstract int update(String sql, SqlParameterSource args)
Execute the supplied SQL statement with supplied arguments.

Public Methods

public abstract int[] batchUpdate (String sql, SqlParameterSource[] batchArgs)

Execute a batch using the supplied SQL statement with the batch of supplied arguments. Uses sql with the named parameter support.

Parameters
sql the SQL statement to execute
batchArgs the array of SqlParameterSource containing the batch of arguments for the query
Returns
  • an array containing the numbers of rows affected by each update in the batch

public abstract int[] batchUpdate (String sql, List<Object[]> batchArgs, int[] argTypes)

Execute a batch using the supplied SQL statement with the batch of supplied arguments. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL statement to execute.
batchArgs the List of Object arrays containing the batch of arguments for the query
argTypes SQL types of the arguments (constants from java.sql.Types)
Returns
  • an array containing the numbers of rows affected by each update in the batch

public abstract int[] batchUpdate (String sql, Map[]<String, ?> batchValues)

Executes a batch using the supplied SQL statement with the batch of supplied arguments. Uses sql with the named parameter support.

Parameters
sql the SQL statement to execute
batchValues the array of Maps containing the batch of arguments for the query
Returns
  • an array containing the numbers of rows affected by each update in the batch

public abstract int[] batchUpdate (String sql, List<Object[]> batchArgs)

Execute a batch using the supplied SQL statement with the batch of supplied arguments. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL statement to execute
batchArgs the List of Object arrays containing the batch of arguments for the query
Returns
  • an array containing the numbers of rows affected by each update in the batch

public abstract JdbcOperations getJdbcOperations ()

Expose the classic Spring JdbcTemplate to allow invocation of less commonly used methods.

public abstract NamedParameterJdbcOperations getNamedParameterJdbcOperations ()

Expose the Spring NamedParameterJdbcTemplate to allow invocation of less commonly used methods.

public abstract List<T> query (String sql, ParameterizedRowMapper<T> rm, Object... args)

This method is deprecated.
as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.

Query for a List of Objects of type T using the supplied ParameterizedRowMapper to the query results to the object. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
rm the @ParameterizedRowMapper to use for result mapping
args the variable number of arguments for the query

public abstract List<T> query (String sql, RowMapper<T> rm, SqlParameterSource args)

Query for a List of Objects of type T using the supplied RowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @RowMapper to use for result mapping
args the SqlParameterSource containing the arguments for the query

public abstract List<T> query (String sql, RowMapper<T> rm, Map<String, ?> args)

Query for a List of Objects of type T using the supplied RowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @RowMapper to use for result mapping
args the map containing the arguments for the query

public abstract List<T> query (String sql, RowMapper<T> rm, Object... args)

Query for a List of Objects of type T using the supplied RowMapper to the query results to the object. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
rm the @RowMapper to use for result mapping
args the variable number of arguments for the query

public abstract List<T> query (String sql, ParameterizedRowMapper<T> rm, Map<String, ?> args)

This method is deprecated.
as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.

Query for a List of Objects of type T using the supplied ParameterizedRowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @ParameterizedRowMapper to use for result mapping
args the map containing the arguments for the query

public abstract List<T> query (String sql, ParameterizedRowMapper<T> rm, SqlParameterSource args)

This method is deprecated.
as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.

Query for a List of Objects of type T using the supplied ParameterizedRowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @ParameterizedRowMapper to use for result mapping
args the SqlParameterSource containing the arguments for the query

public abstract int queryForInt (String sql, SqlParameterSource args)

Query for an int passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a SqlParameterSource containing the arguments.

Parameters
sql the SQL query to run.
args the SqlParameterSource containing the arguments for the query.

public abstract int queryForInt (String sql, Map<String, ?> args)

Query for an int passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a map containing the arguments.

Parameters
sql the SQL query to run.
args the map containing the arguments for the query

public abstract int queryForInt (String sql, Object... args)

Query for an int passing in a SQL query using the standard '?' placeholders for parameters and a variable number of arguments.

Parameters
sql the SQL query to run.
args the variable number of arguments for the query

public abstract List<Map<StringObject>> queryForList (String sql, SqlParameterSource args)

Execute the supplied query with the supplied arguments.

Each element in the returned List is constructed as a Map as described in queryForMap(String, Object...) Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
args the SqlParameterSource containing the arguments for the query

public abstract List<Map<StringObject>> queryForList (String sql, Map<String, ?> args)

Execute the supplied query with the supplied arguments.

Each element in the returned List is constructed as a Map as described in queryForMap(String, Object...) Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
args the map containing the arguments for the query

public abstract List<Map<StringObject>> queryForList (String sql, Object... args)

Execute the supplied query with the (optional) supplied arguments.

Each element in the returned List is constructed as a Map as described in queryForMap(String, Object...) Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
args the variable number of arguments for the query

public abstract long queryForLong (String sql, SqlParameterSource args)

Query for an long passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a SqlParameterSource containing the arguments.

Parameters
sql the SQL query to run.
args the SqlParameterSource containing the arguments for the query

public abstract long queryForLong (String sql, Map<String, ?> args)

Query for an long passing in a SQL query using the named parameter support provided by the NamedParameterJdbcTemplate and a map containing the arguments.

Parameters
sql the SQL query to run.
args the map containing the arguments for the query

public abstract long queryForLong (String sql, Object... args)

Query for an long passing in a SQL query using the standard '?' placeholders for parameters and a variable number of arguments.

Parameters
sql the SQL query to run.
args the variable number of arguments for the query

public abstract Map<StringObject> queryForMap (String sql, Object... args)

Execute the supplied query with the (optional) supplied arguments.

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). Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
args the variable number of arguments for the query

public abstract Map<StringObject> queryForMap (String sql, SqlParameterSource args)

Execute the supplied query with the supplied arguments.

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). Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
args the SqlParameterSource containing the arguments for the query

public abstract Map<StringObject> queryForMap (String sql, Map<String, ?> args)

Execute the supplied query with the supplied arguments.

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). Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
args the map containing the arguments for the query

public abstract T queryForObject (String sql, Class<T> requiredType, Map<String, ?> args)

Query for an object of type T identified by the supplied @Class. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
requiredType the required type of the return value
args the map containing the arguments for the query

public abstract T queryForObject (String sql, RowMapper<T> rm, Object... args)

Query for an object of type T using the supplied RowMapper to the query results to the object. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
rm the @RowMapper to use for result mapping
args the variable number of arguments for the query

public abstract T queryForObject (String sql, RowMapper<T> rm, SqlParameterSource args)

Query for an object of type T using the supplied RowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @RowMapper to use for result mapping
args the SqlParameterSource containing the arguments for the query

public abstract T queryForObject (String sql, Class<T> requiredType, Object... args)

Query for an object of type T identified by the supplied @Class. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
requiredType the required type of the return value
args the variable number of arguments for the query

public abstract T queryForObject (String sql, Class<T> requiredType, SqlParameterSource args)

Query for an object of type T identified by the supplied @Class. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
requiredType the required type of the return value
args the SqlParameterSource containing the arguments for the query

public abstract T queryForObject (String sql, ParameterizedRowMapper<T> rm, SqlParameterSource args)

This method is deprecated.
as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.

Query for an object of type T using the supplied ParameterizedRowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @ParameterizedRowMapper to use for result mapping
args the SqlParameterSource containing the arguments for the query

public abstract T queryForObject (String sql, ParameterizedRowMapper<T> rm, Object... args)

This method is deprecated.
as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.

Query for an object of type T using the supplied ParameterizedRowMapper to the query results to the object. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL query to run
rm the @ParameterizedRowMapper to use for result mapping
args the variable number of arguments for the query

public abstract T queryForObject (String sql, ParameterizedRowMapper<T> rm, Map<String, ?> args)

This method is deprecated.
as of Spring 3.0: Use the method using the newly genericized RowMapper interface instead since the RowMapper and ParameterizedRowMapper interfaces are equivalent now.

Query for an object of type T using the supplied ParameterizedRowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @ParameterizedRowMapper to use for result mapping
args the map containing the arguments for the query

public abstract T queryForObject (String sql, RowMapper<T> rm, Map<String, ?> args)

Query for an object of type T using the supplied RowMapper to the query results to the object. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL query to run
rm the @RowMapper to use for result mapping
args the map containing the arguments for the query

public abstract int update (String sql, Map<String, ?> args)

Execute the supplied SQL statement with (optional) supplied arguments. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL statement to execute
args the map containing the arguments for the query
Returns
  • the numbers of rows affected by the update

public abstract int update (String sql, Object... args)

Execute the supplied SQL statement with supplied arguments. Uses sql with the standard '?' placeholders for parameters

Parameters
sql the SQL statement to execute
args the variable number of arguments for the query
Returns
  • the numbers of rows affected by the update

public abstract int update (String sql, SqlParameterSource args)

Execute the supplied SQL statement with supplied arguments. Uses sql with the named parameter support provided by the NamedParameterJdbcTemplate

Parameters
sql the SQL statement to execute
args the SqlParameterSource containing the arguments for the statement
Returns
  • the numbers of rows affected by the update