|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hdpagination.dataaccess.support.jdbc.BeanPropertyRowMapper
public class BeanPropertyRowMapper
RowMapper implementation that converts a row into a new instance of the specified mapped target class. The mapped target class must be a top-level class and it must have a default or no-arg constructor. Column values are mapped based on matching the column name as obtained from result set metadata to public setters for the corresponding properties. The names are matched either directly or by transforming a name separating the parts with underscores to the same name using "camel" case. Mapping is provided for fields in the target class for many common types, e.g.: String, boolean, Boolean, byte, Byte, short, Short, int, Integer, long, Long, float, Float, double, Double, BigDecimal, java.util.Date, etc. To facilitate mapping between columns and fields that don't have matching names, try using column aliases in the SQL statement like "select fname as first_name from customer. Please note that this class is designed to provide convenience rather than high performance. For best performance consider using a custom RowMapper.
Also very importantly, this class internally uses some classes available only since Spring framework 2.5.2. So this class can only be used if Spring framework 2.5.2 or later version is used.
| Method Summary | |
|---|---|
protected void |
initialize(java.lang.Class mappedClass)
Initialize the mapping metadata for the given class. |
static BeanPropertyRowMapper |
newInstance(java.lang.Class mappedClass)
|
java.lang.Object |
processRow(java.sql.ResultSet rs)
Implementations must implement this method to map each row of data in the ResultSet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static BeanPropertyRowMapper newInstance(java.lang.Class mappedClass)
protected void initialize(java.lang.Class mappedClass)
mappedClass - the mapped class.
public java.lang.Object processRow(java.sql.ResultSet rs)
throws java.sql.SQLException
RowMapper
processRow in interface RowMapperrs - the ResultSet to map (pre-initialized for the current row)
java.sql.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 | ||||||||