RowMapperimplementation that creates a
java.util.Mapfor each row, representing all columns as key-value pairs: one entry for each column, with the column name as key.
Note: By default, ColumnMapRowMapper will try to build a linked Map with case-insensitive keys, to preserve column order as well as allow any casing to be used for column names. This requires Commons Collections on the classpath (which will be autodetected). Else, the fallback is a standard linked HashMap, which will still preserve column order but requires the application to specify the column names in the same casing as exposed by the driver.
|Constructor and Description|
|Modifier and Type||Method and Description|
Create a Map instance to be used as column map.
Determine the key to use for the given column in the column Map.
Retrieve a JDBC object value for the specified column.
Implementations must implement this method to map each row of data in the ResultSet.
public Map<String,Object> mapRow(ResultSet rs, int rowNum) throws SQLException
next()on the ResultSet; it is only supposed to map values of the current row.
rs- the ResultSet to map (pre-initialized for the current row)
rowNum- the number of the current row
SQLException- if a SQLException is encountered getting column values (that is, there's no need to catch SQLException)
By default, a linked case-insensitive Map will be created.
columnCount- the column count, to be used as initial capacity for the Map
columnName- the column name as returned by the ResultSet
protected Object getColumnValue(ResultSet rs, int index) throws SQLException
The default implementation uses the
Additionally, this implementation includes a "hack" to get around Oracle
returning a non standard object for their TIMESTAMP datatype.
rs- is the ResultSet holding the data
index- is the column index
JdbcUtils.getResultSetValue(java.sql.ResultSet, int, java.lang.Class)