Package com.randomnoun.common.spring
Class LongRowMapper
java.lang.Object
com.randomnoun.common.spring.LongRowMapper
- All Implemented Interfaces:
org.springframework.jdbc.core.RowMapper<Long>
This class is intended to replace the standard RowMapper provided by Spring
to return a List of Long objects (rather than a List of Maps). The
queries executed by this rowMapper must therefore always evaluate to
a single numeric column
This class can be used as in the following code fragment:
List longList = jt.query( "SELECT DISTINCT lngId FROM tblCave " + "WHERE txtSecretPassword = ? ", new Object[] { "open sesame" }, new RowMapperResultReader(new LongRowMapper() ));
- Author:
- knoxg
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
LongRowMapper
public LongRowMapper()Creates a new ClobRowMapper object.
-
-
Method Details
-
mapRow
Returns a single Long representing this row.- Specified by:
mapRow
in interfaceorg.springframework.jdbc.core.RowMapper<Long>
- Parameters:
resultSet
- The resultset to maprowNumber
- The current row number- Returns:
- a single object representing this row.
- Throws:
org.springframework.dao.TypeMismatchDataAccessException
- if the first column of the resultset is not numeric.SQLException
-