Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jdbc.core.simple
Interface SimpleJdbcOperations

All Known Implementing Classes:
  SimpleJdbcTemplate

    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.

Since:
  2.0
Author:
  Rod Johnson, Rob Harrop
See Also:
  `SimpleJdbcTemplate`, `JdbcOperations`

Method Summary
`JdbcOperations` | `getJdbcOperations()` Expose the classic Spring JdbcTemplate to allow invocation of less commonly used methods.
`
`<T> List<T>`
` | `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.
`
`<T> T`
` | `queryForObject(String sql, Class<T> requiredType, Object... args)` Query for an object of type `T` identified by the supplied @`Class`.
`
`<T> T`
` | `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)` Execute the supplied SQL statement with (optional) supplied arguments.

Method Detail

### getJdbcOperations

    JdbcOperations getJdbcOperations()

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

### queryForInt

    int queryForInt(String sql,
                    Object... args)
                    throws DataAccessException

  Query for an `int` passing in a SQL query and a variable number of arguments.

  Throws:
    `DataAccessException`

### queryForLong

    long queryForLong(String sql,
                      Object... args)
                      throws DataAccessException

  Query for an `long` passing in a SQL query and a variable number of arguments.

  Throws:
    `DataAccessException`

### queryForObject

    <T> T queryForObject(String sql,
                         Class<T> requiredType,
                         Object... args)
                     throws DataAccessException

  Query for an object of type `T` identified by the supplied @`Class`.

  Parameters:
    `sql` - the SQL query to run.
    `requiredType` - the required type of the return value.
    `args` - the args for the query.
  Throws:
    `DataAccessException`
  See Also:
    `JdbcOperations.queryForObject(String, Class)`, `JdbcOperations.queryForObject(String, Object[], Class)`

### queryForObject

    <T> T queryForObject(String sql,
                         ParameterizedRowMapper<T> rm,
                         Object... args)
                     throws DataAccessException

  Query for an object of type `T` using the supplied `ParameterizedRowMapper` to the query results to the object.

  Parameters:
    `sql` - the SQL query to run.
    `rm` - the @`ParameterizedRowMapper` to use for result mapping
    `args` - the args for the query.
  Throws:
    `DataAccessException`
  See Also:
    `JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)`, `JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)`

### query

    <T> List<T> query(String sql,
                      ParameterizedRowMapper<T> rm,
                      Object... args)
                  throws DataAccessException

  Query for a `List` of `Objects` of type `T` using the supplied `ParameterizedRowMapper` to the query results to the object.

  Parameters:
    `sql` - the SQL query to run.
    `rm` - the @`ParameterizedRowMapper` to use for result mapping
    `args` - the args for the query.
  Throws:
    `DataAccessException`
  See Also:
    `JdbcOperations.queryForObject(String, org.springframework.jdbc.core.RowMapper)`, `JdbcOperations.queryForObject(String, Object[], org.springframework.jdbc.core.RowMapper)`

### queryForMap

    Map<String,Object> queryForMap(String sql,
                                   Object... args)
                                   throws DataAccessException

  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).

  Throws:
    `DataAccessException`
  See Also:
    `JdbcOperations.queryForMap(String)`, `JdbcOperations.queryForMap(String, Object[])`

### queryForList

    List<Map<String,Object>> queryForList(String sql,
                                          Object... args)
                                          throws DataAccessException

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

  Each element in the returned `List` is constructed as a `Map` as described in `queryForMap(java.lang.String, java.lang.Object...)`

  Throws:
    `DataAccessException`
  See Also:
    `JdbcOperations.queryForList(String)`, `JdbcOperations.queryForList(String, Object[])`

### update

    int update(String sql,
               Object... args)
               throws DataAccessException

  Execute the supplied SQL statement with (optional) supplied arguments.

  Returns:
    the numbers of rows affected by the update.
  Throws:
    `DataAccessException`
  See Also:
    `JdbcOperations.update(String)`, `JdbcOperations.update(String, Object[])`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2007 The Spring Framework.