October 2017
Intermediate to advanced
396 pages
10h 2m
English
Spring provides a ResultSetExtractor interface for processing an entire ResultSet at once. Here, you are responsible for iterating the ResultSet, for example, for mapping the entire ResultSet to a single object. Let's see the following example:
public interface ResultSetExtractor<T> {
T extractData(ResultSet rs) throws SQLException, DataAccessException;
}
Example for using a ResultSetExtractor
The following line of code implements the ResultSetExtractor interface in the application:
package com.packt.patterninspring.chapter7.bankapp.callbacks; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.springframework.dao.DataAccessException; import ...
Read now
Unlock full access