T
- the type of object resulting from the packingpublic interface ResultPacker<T>
Modifier and Type | Method and Description |
---|---|
T |
fetch(java.sql.ResultSet resultSet)
Fetches a single instance from the given result set, assumes
ResultSet.next() has been called |
default java.util.List<T> |
pack(java.sql.ResultSet resultSet,
int fetchCount)
Iterates through the given ResultSet, packing its contents into a List using
fetch(ResultSet) in the order they appear. |
default java.util.List<T> pack(java.sql.ResultSet resultSet, int fetchCount) throws java.sql.SQLException
fetch(ResultSet)
in the order they appear.
Items are skipped if fetch(ResultSet)
returns null.
This method does not close or modify the ResultSet in any way.resultSet
- the ResultSet instance containing the query result to processfetchCount
- the maximum number of records to fetch from the result set,
a negative value means all should be fetched.java.sql.SQLException
- thrown if anything goes wrong during the packingjava.lang.NullPointerException
- in case resultSet is nullT fetch(java.sql.ResultSet resultSet) throws java.sql.SQLException
ResultSet.next()
has been calledresultSet
- the result setjava.sql.SQLException
- in case of failure