T - the mapped type@FunctionalInterface public interface ResultSetMapper<T>
| Modifier and Type | Method and Description |
|---|---|
T |
mapResultSet(Supplier<ResultSet> resultSetSupplier,
StatementContext ctx)
Maps the lazily-supplied result set into an object.
|
T mapResultSet(Supplier<ResultSet> resultSetSupplier, StatementContext ctx) throws SQLException
resultSetSupplier.get() is called.
Implementors that call resultSetSupplier.get() must ensure that the statement context is closed, to
ensure that database resources are freed:
try {
ResultSet resultSet = resultSetSupplier.get()
// generate and return result from the result set.
}
finally {
ctx.close();
}
Alternatively, implementors may return some intermediate result object (e.g. ResultIterable) without
calling resultSetSupplier.get(), in which case the burden of closing resources falls to whichever object
ultimately does get() the result set.
resultSetSupplier - supplies a ResultSet.ctx - the statement context.SQLException - if anything goes wrongCopyright © 2017. All rights reserved.