|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SimpleJdbcOperations
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.
NamedParameterJdbcTemplate
,
SimpleJdbcTemplate
,
JdbcOperations
Method Summary | ||
---|---|---|
int[] |
batchUpdate(String sql,
List<Object[]> batchArgs)
Execute a batch using the supplied SQL statement with the batch of supplied arguments. |
|
int[] |
batchUpdate(String sql,
List<Object[]> batchArgs,
int[] argTypes)
Execute a batch using the supplied SQL statement with the batch of supplied arguments. |
|
int[] |
batchUpdate(String sql,
Map[] batchValues)
Executes a batch using the supplied SQL statement with the batch of supplied arguments. |
|
int[] |
batchUpdate(String sql,
SqlParameterSource[] batchArgs)
Execute a batch using the supplied SQL statement with the batch of supplied arguments. |
|
JdbcOperations |
getJdbcOperations()
Expose the classic Spring JdbcTemplate to allow invocation of less commonly used methods. |
|
NamedParameterJdbcOperations |
getNamedParameterJdbcOperations()
Expose the Spring NamedParameterJdbcTemplate to allow invocation of less commonly used methods. |
|
|
query(String sql,
ParameterizedRowMapper<T> rm,
Map args)
Query for a List of Objects of type T using
the supplied ParameterizedRowMapper to the query results to the object. |
|
|
query(String sql,
ParameterizedRowMapper<T> rm,
Object... args)
Query for a List of Objects of type T using
the supplied ParameterizedRowMapper to the query results to the object. |
|
|
query(String sql,
ParameterizedRowMapper<T> rm,
SqlParameterSource args)
Query for a List of Objects of type T using
the supplied ParameterizedRowMapper to the query results to the object. |
|
int |
queryForInt(String sql,
Map 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. |
|
int |
queryForInt(String sql,
Object... args)
Query for an int passing in a SQL query
using the standard '?' |
|
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. |
|
List<Map<String,Object>> |
queryForList(String sql,
Map args)
Execute the supplied query with the supplied arguments. |
|
List<Map<String,Object>> |
queryForList(String sql,
Object... args)
Execute the supplied query with the (optional) supplied arguments. |
|
List<Map<String,Object>> |
queryForList(String sql,
SqlParameterSource args)
Execute the supplied query with the supplied arguments. |
|
long |
queryForLong(String sql,
Map 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. |
|
long |
queryForLong(String sql,
Object... args)
Query for an long passing in a SQL query
using the standard '?' |
|
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. |
|
Map<String,Object> |
queryForMap(String sql,
Map args)
Execute the supplied query with the supplied arguments. |
|
Map<String,Object> |
queryForMap(String sql,
Object... args)
Execute the supplied query with the (optional) supplied arguments. |
|
Map<String,Object> |
queryForMap(String sql,
SqlParameterSource args)
Execute the supplied query with the supplied arguments. |
|
|
queryForObject(String sql,
Class<T> requiredType,
Map args)
Query for an object of type T identified by the supplied @Class . |
|
|
queryForObject(String sql,
Class<T> requiredType,
Object... args)
Query for an object of type T identified by the supplied @Class . |
|
|
queryForObject(String sql,
Class<T> requiredType,
SqlParameterSource args)
Query for an object of type T identified by the supplied @Class . |
|
|
queryForObject(String sql,
ParameterizedRowMapper<T> rm,
Map args)
Query for an object of type T using the supplied
ParameterizedRowMapper to the query results to the object. |
|
|
queryForObject(String sql,
ParameterizedRowMapper<T> rm,
Object... args)
Query for an object of type T using the supplied
ParameterizedRowMapper to the query results to the object. |
|
|
queryForObject(String sql,
ParameterizedRowMapper<T> rm,
SqlParameterSource args)
Query for an object of type T using the supplied
ParameterizedRowMapper to the query results to the object. |
|
int |
update(String sql,
Map args)
Execute the supplied SQL statement with (optional) supplied arguments. |
|
int |
update(String sql,
Object... args)
Execute the supplied SQL statement with supplied arguments. |
|
int |
update(String sql,
SqlParameterSource args)
Execute the supplied SQL statement with supplied arguments. |
Method Detail |
---|
JdbcOperations getJdbcOperations()
NamedParameterJdbcOperations getNamedParameterJdbcOperations()
int queryForInt(String sql, Map args) throws DataAccessException
int
passing in a SQL query
using the named parameter support provided by the
NamedParameterJdbcTemplate
and a map containing the arguments.
sql
- the SQL query to run.args
- the map containing the arguments for the query.
DataAccessException
int queryForInt(String sql, SqlParameterSource args) throws DataAccessException
int
passing in a SQL query
using the named parameter support provided by the
NamedParameterJdbcTemplate
and a SqlParameterSource
containing the arguments.
sql
- the SQL query to run.args
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
int queryForInt(String sql, Object... args) throws DataAccessException
int
passing in a SQL query
using the standard '?' placeholders for parameters
and a variable number of arguments.
sql
- the SQL query to run.args
- the variable number of arguments for the query.
DataAccessException
long queryForLong(String sql, Map args) throws DataAccessException
long
passing in a SQL query
using the named parameter support provided by the
NamedParameterJdbcTemplate
and a map containing the arguments.
sql
- the SQL query to run.args
- the map containing the arguments for the query.
DataAccessException
long queryForLong(String sql, SqlParameterSource args) throws DataAccessException
long
passing in a SQL query
using the named parameter support provided by the
NamedParameterJdbcTemplate
and a SqlParameterSource
containing the arguments.
sql
- the SQL query to run.args
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
long queryForLong(String sql, Object... args) throws DataAccessException
long
passing in a SQL query
using the standard '?' placeholders for parameters
and a variable number of arguments.
sql
- the SQL query to run.args
- the variable number of arguments for the query.
DataAccessException
<T> T queryForObject(String sql, Class<T> requiredType, Map args) throws DataAccessException
T
identified by the supplied @Class
.
Uses sql with the named parameter support provided by the
NamedParameterJdbcTemplate
sql
- the SQL query to run.requiredType
- the required type of the return value.args
- the map containing the arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, Class)
,
JdbcOperations.queryForObject(String, Object[], Class)
<T> T queryForObject(String sql, Class<T> requiredType, SqlParameterSource args) throws DataAccessException
T
identified by the supplied @Class
.
Uses sql with the named parameter support provided by the
NamedParameterJdbcTemplate
sql
- the SQL query to run.requiredType
- the required type of the return value.args
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, Class)
,
JdbcOperations.queryForObject(String, Object[], Class)
<T> T queryForObject(String sql, Class<T> requiredType, Object... args) throws DataAccessException
T
identified by the supplied @Class
.
Uses sql with the standard '?' placeholders for parameters
sql
- the SQL query to run.requiredType
- the required type of the return value.args
- the variable number of arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, Class)
,
JdbcOperations.queryForObject(String, Object[], Class)
<T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, Map args) throws DataAccessException
T
using the supplied
ParameterizedRowMapper
to the query results to the object.
Uses sql with the named parameter support provided by the
NamedParameterJdbcTemplate
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the map containing the arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)
,
JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
<T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, SqlParameterSource args) throws DataAccessException
T
using the supplied
ParameterizedRowMapper
to the query results to the object.
Uses sql with the named parameter support provided by the
NamedParameterJdbcTemplate
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)
,
JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
<T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, Object... args) throws DataAccessException
T
using the supplied
ParameterizedRowMapper
to the query results to the object.
Uses sql with the standard '?' placeholders for parameters
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the variable number of arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)
,
JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
<T> List<T> query(String sql, ParameterizedRowMapper<T> rm, Map args) throws DataAccessException
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
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the map containing the arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)
,
JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
<T> List<T> query(String sql, ParameterizedRowMapper<T> rm, SqlParameterSource args) throws DataAccessException
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
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)
,
JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
<T> List<T> query(String sql, ParameterizedRowMapper<T> rm, Object... args) throws DataAccessException
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
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the variable number of arguments for the query.
DataAccessException
JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)
,
JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)
Map<String,Object> queryForMap(String sql, Map args) throws DataAccessException
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
sql
- the SQL query to run.args
- the map containing the arguments for the query.
DataAccessException
JdbcOperations.queryForMap(String)
,
JdbcOperations.queryForMap(String, Object[])
Map<String,Object> queryForMap(String sql, SqlParameterSource args) throws DataAccessException
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
sql
- the SQL query to run.args
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
JdbcOperations.queryForMap(String)
,
JdbcOperations.queryForMap(String, Object[])
Map<String,Object> queryForMap(String sql, Object... args) throws DataAccessException
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
sql
- the SQL query to run.args
- the variable number of arguments for the query.
DataAccessException
JdbcOperations.queryForMap(String)
,
JdbcOperations.queryForMap(String, Object[])
List<Map<String,Object>> queryForList(String sql, Map args) throws DataAccessException
Each element in the returned List
is constructed as a Map
as described in queryForMap(java.lang.String, java.util.Map)
Uses sql with the named parameter support provided by the
NamedParameterJdbcTemplate
sql
- the SQL query to run.args
- the map containing the arguments for the query.
DataAccessException
JdbcOperations.queryForList(String)
,
JdbcOperations.queryForList(String, Object[])
List<Map<String,Object>> queryForList(String sql, SqlParameterSource args) throws DataAccessException
Each element in the returned List
is constructed as a Map
as described in queryForMap(java.lang.String, java.util.Map)
Uses sql with the named parameter support provided by the
NamedParameterJdbcTemplate
sql
- the SQL query to run.args
- the SqlParameterSource
containing the arguments for the query.
DataAccessException
JdbcOperations.queryForList(String)
,
JdbcOperations.queryForList(String, Object[])
List<Map<String,Object>> queryForList(String sql, Object... args) throws DataAccessException
Each element in the returned List
is constructed as a Map
as described in queryForMap(java.lang.String, java.util.Map)
Uses sql with the standard '?' placeholders for parameters
sql
- the SQL query to run.args
- the variable number of arguments for the query.
DataAccessException
JdbcOperations.queryForList(String)
,
JdbcOperations.queryForList(String, Object[])
int update(String sql, Map args) throws DataAccessException
NamedParameterJdbcTemplate
sql
- the SQL statement to execute.args
- the map containing the arguments for the query.
DataAccessException
NamedParameterJdbcOperations.update(String, Map)
int update(String sql, SqlParameterSource args) throws DataAccessException
NamedParameterJdbcTemplate
sql
- the SQL statement to execute.args
- the SqlParameterSource
containing the arguments for the statement.
DataAccessException
NamedParameterJdbcOperations.update(String, SqlParameterSource)
int update(String sql, Object... args) throws DataAccessException
sql
- the SQL statement to execute.args
- the variable number of arguments for the query.
DataAccessException
JdbcOperations.update(String)
,
JdbcOperations.update(String, Object[])
int[] batchUpdate(String sql, Map[] batchValues)
sql
- the SQL statement to execute.batchValues
- the array of Maps containing the batch of arguments for the query.
int[] batchUpdate(String sql, SqlParameterSource[] batchArgs)
sql
- the SQL statement to execute.batchArgs
- the array of SqlParameterSource
containing the batch of arguments for the query.
int[] batchUpdate(String sql, List<Object[]> batchArgs)
sql
- the SQL statement to execute.batchArgs
- the List of Object arrays containing the batch of arguments for the query.
int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes)
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
)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |