Subclasses can be constructed providing SQL, parameter types and a DataSource. SQL will often vary between subclasses.
org.springframework.jdbc.object.SqlQuery
| Modifier and Type | Class and Description |
|---|---|
| protected class | UpdatableSqlQuery.RowMapperImpl
Implementation of RowMapper that calls the enclosing
class's |
| Access | Constructor and Description |
|---|---|
| public | |
| public | UpdatableSqlQuery(DataSource
the DataSource to use to get connections ds, String the SQL to run sql)Convenient constructor with DataSource and SQL string. |
| Modifier and Type | Method and Description |
|---|---|
| protected RowMapper | newRowMapper(Object[]
the parameters to the parameters, Map<?, ?> execute() method,
in case subclass is interested; may be null if there
were no parameters.the contextual information passed to the context)mapRow
callback method. The JDBC operation itself doesn't rely on this parameter,
but it can be useful for creating the objects of the result list.Implements abstract org. |
| protected abstract T | Returns: an object of the result typethe ResultSet we're working through rs, int row number (from 0) we're up to rowNum, Map<?, ?> passed to the context)execute() method.
It can be null if no contextual information is need. If you
need to pass in data for each row, you can pass in a HashMap with
the primary key of the row being the key for the HashMap. That way
it is easy to locate the updates for each rowSubclasses must implement this method to update each row of the ResultSet and optionally create object of the result type. |
| UpdatableSqlQuery | back to summary |
|---|---|
| public UpdatableSqlQuery() Constructor to allow use as a JavaBean. | |
| UpdatableSqlQuery | back to summary |
|---|---|
| public UpdatableSqlQuery(DataSource ds, String sql) Convenient constructor with DataSource and SQL string.
| |
| newRowMapper | back to summary |
|---|---|
| protected RowMapper Implements abstract org. Implementation of the superclass template method. This invokes the subclass's
implementation of the
| |
| updateRow | back to summary |
|---|---|
| protected abstract T updateRow(ResultSet rs, int rowNum, Map<?, ?> context) throws SQLException Subclasses must implement this method to update each row of the ResultSet and optionally create object of the result type.
| |
updateRow() method for each row.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public T | mapRow(ResultSet
the rs, int ResultSet to map (pre-initialized for the current row)the number of the current row rowNum)Implements org. ResultSet.
|
| context | back to summary |
|---|---|
| private final Map<?, ?> context
| |
| RowMapperImpl | back to summary |
|---|---|
| public RowMapperImpl(Map<?, ?> context) | |
| mapRow | back to summary |
|---|---|
| public T mapRow(ResultSet rs, int rowNum) throws SQLException Implements org. Doc from org. Implementations must implement this method to map each row of data in the
| |