|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface RowMapper
An interface used by JdbcTemplate for mapping returned result sets. Implementations of this interface perform the actual work of mapping rows, but don't need to worry about exception handling. SQLExceptions will be caught and handled correctly by the JdbcTemplate class.
Typically used either for JdbcTemplate's query methods (with RowMapperResultReader adapters) or for out parameters of stored procedures. RowMapper objects are typically stateless and thus reusable; they are ideal choices for implementing row-mapping logic in a single place.
Alternatively, consider subclassing MappingSqlQuery from the jdbc.object package: Instead of working with separate JdbcTemplate and RowMapper objects, you can have executable query objects (containing row-mapping logic) there.
JdbcTemplate
,
RowMapperResultReader
,
MappingSqlQuery
Method Summary | |
---|---|
Object |
mapRow(ResultSet rs,
int rowNum)
Implementations must implement this method to map each row of data in the ResultSet. |
Method Detail |
---|
Object mapRow(ResultSet rs, int rowNum) throws SQLException
rs
- the ResultSet to maprowNum
- The number of the current row
SQLException
- if a SQLException is encountered getting
column values (that is, there's no need to catch SQLException)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |