|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SimpleJdbcOperations
JDBC operations nterface usable on Java 5 and above, exposing a set of common JDBC operations, whose interface is simplified through the use of varargs and autoboxing.
SimpleJdbcTemplate
,
JdbcOperations
Method Summary | ||
---|---|---|
JdbcOperations |
getJdbcOperations()
Expose the classic Spring JdbcTemplate to allow invocation of less commonly used methods. |
|
|
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. |
|
int |
queryForInt(String sql,
Object... args)
Query for an int passing in a SQL query and a variable
number of arguments. |
|
List<Map<String,Object>> |
queryForList(String sql,
Object... args)
Execute the supplied query with the (optional) supplied arguments. |
|
long |
queryForLong(String sql,
Object... args)
Query for an long passing in a SQL query and a variable
number of arguments. |
|
Map<String,Object> |
queryForMap(String sql,
Object... args)
Execute the supplied query with the (optional) supplied arguments. |
|
|
queryForObject(String sql,
Class<T> requiredType,
Object... args)
Query for an object of type T identified by the supplied @Class . |
|
|
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. |
|
int |
update(String sql,
Object... args)
Executes the supplied SQL statement with (optional) supplied arguments. |
Method Detail |
---|
JdbcOperations getJdbcOperations()
int queryForInt(String sql, Object... args) throws DataAccessException
int
passing in a SQL query and a variable
number of arguments.
DataAccessException
long queryForLong(String sql, Object... args) throws DataAccessException
long
passing in a SQL query and a variable
number of arguments.
DataAccessException
<T> T queryForObject(String sql, Class<T> requiredType, Object... args) throws DataAccessException
T
identified by the supplied @Class
.
sql
- the SQL query to run.requiredType
- the required type of the return value.args
- the args for the query.
DataAccessException
JdbcOperations.queryForObject(String, Class)
,
JdbcOperations.queryForObject(String, Object[], Class)
<T> T queryForObject(String sql, ParameterizedRowMapper<T> rm, Object... args) throws DataAccessException
T
using the supplied
ParameterizedRowMapper
to the query results to the object.
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the args 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.
sql
- the SQL query to run.rm
- the @ParameterizedRowMapper
to use for result mappingargs
- the args 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, 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).
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.lang.Object...)
int update(String sql, Object... args) throws DataAccessException
DataAccessException
JdbcOperations.update(String)
,
JdbcOperations.update(String, Object[])
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |