Package org.springframework.jdbc.core
Class ColumnMapRowMapper
java.lang.Object
org.springframework.jdbc.core.ColumnMapRowMapper
RowMapper implementation that creates a java.util.Map
 for each row, representing all columns as key-value pairs: one
 entry for each column, with the column name as key.
 The Map implementation to use and the key to use for each column
 in the column Map can be customized by overriding createColumnMap(int)
 and getColumnKey(java.lang.String), respectively.
 
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.
- Since:
- 1.2
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptioncreateColumnMap(int columnCount) Create a Map instance to be used as column map.protected StringgetColumnKey(String columnName) Determine the key to use for the given column in the column Map.getColumnValue(ResultSet rs, int index) Retrieve a JDBC object value for the specified column.Implementations must implement this method to map each row of data in theResultSet.
- 
Constructor Details- 
ColumnMapRowMapperpublic ColumnMapRowMapper()
 
- 
- 
Method Details- 
mapRowDescription copied from interface:RowMapperImplementations must implement this method to map each row of data in theResultSet. This method should not callnext()on theResultSet; it is only supposed to map values of the current row.- Specified by:
- mapRowin interface- RowMapper<Map<String,- Object>> 
- Parameters:
- rs- the- ResultSetto map (pre-initialized for the current row)
- rowNum- the number of the current row
- Returns:
- the result object for the current row (may be null)
- Throws:
- SQLException- if an SQLException is encountered while getting column values (that is, there's no need to catch SQLException)
 
- 
createColumnMapCreate a Map instance to be used as column map.By default, a linked case-insensitive Map will be created. - Parameters:
- columnCount- the column count, to be used as initial capacity for the Map
- Returns:
- the new Map instance
- See Also:
 
- 
getColumnKeyDetermine the key to use for the given column in the column Map.By default, the supplied column name will be returned unmodified. - Parameters:
- columnName- the column name as returned by the ResultSet
- Returns:
- the column key to use
- See Also:
 
- 
getColumnValueRetrieve a JDBC object value for the specified column.The default implementation uses the getObjectmethod. Additionally, this implementation includes a "hack" to get around Oracle returning a non-standard object for their TIMESTAMP data type.- Parameters:
- rs- the ResultSet holding the data
- index- the column index
- Returns:
- the Object returned
- Throws:
- SQLException
- See Also:
 
 
-