RowMapperimplementation to easily compose existing RowMappers. As the name implies, it is most commonly used for retrieving multiple tables' Java representations from a joined row.
|Modifier and Type||Method and Description|
Create a JoinRowMapper that maps each of the given types and returns a
Map the row the result set is at when passed in.
Returns a specialized row mapper, optimized for the given result set.
public JoinRow map(ResultSet r, StatementContext ctx) throws SQLException
public RowMapper<JoinRow> specialize(ResultSet r, StatementContext ctx) throws SQLException
Before mapping the result set from a SQL statement; Jdbi will first call this method to obtain a specialized instance. The returned mapper will then be used to map the result set rows, and discarded.
Implementing this method is optional; the default implementation returns
this. Implementors might choose
to override this method to improve performance, e.g. by matching up column names to properties once for the
entire result set, rather than repeating the process for every row.
r- the result set to specialize over
ctx- the statement context to specialize over
SQLException- if anything goes wrong go ahead and let this percolate; Jdbi will handle it
for an example of specialization.
Copyright © 2018. All rights reserved.