Delegates to the streamData template method for streaming LOB
content to some OutputStream, typically using a LobHandler. Converts an
IOException thrown during streaming to a LobRetrievalFailureException.
A usage example with JdbcTemplate:
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); // reusable object
final LobHandler lobHandler = new DefaultLobHandler(); // reusable object
jdbcTemplate.query(
"SELECT content FROM imagedb WHERE image_name=?", new Object[] {name},
new AbstractLobStreamingResultSetExtractor() {
public void streamData(ResultSet rs) throws SQLException, IOException {
FileCopyUtils.copy(lobHandler.getBlobAsBinaryStream(rs, 1), contentStream);
}
});
org.springframework.jdbc.support.lob.LobHandler , org.springframework.jdbc.LobRetrievalFailureException
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final T | extractData(ResultSet
the ResultSet to extract data from. Implementations should
not close this: it will be closed by the calling JdbcTemplate. rs)Implements org. |
| protected void | |
| protected void | |
| protected abstract void | streamData(ResultSet
the ResultSet to take the LOB content from rs)Stream LOB content from the given ResultSet to some OutputStream. |
| AbstractLobStreamingResultSetExtractor | back to summary |
|---|---|
| public AbstractLobStreamingResultSetExtractor() | |
| extractData | back to summary |
|---|---|
| public final T extractData(ResultSet rs) throws SQLException, DataAccessException Implements org. Delegates to handleNoRowFound, handleMultipleRowsFound and streamData, according to the ResultSet state. Converts an IOException thrown by streamData to a LobRetrievalFailureException.
| |
| handleMultipleRowsFound | back to summary |
|---|---|
| protected void handleMultipleRowsFound() throws DataAccessException Handle the case where the ResultSet contains multiple rows.
| |
| handleNoRowFound | back to summary |
|---|---|
| protected void handleNoRowFound() throws DataAccessException Handle the case where the ResultSet does not contain a row.
| |
| streamData | back to summary |
|---|---|
| protected abstract void streamData(ResultSet rs) throws SQLException, IOException, DataAccessException Stream LOB content from the given ResultSet to some OutputStream. Typically used as inner class, with access to surrounding method arguments and to a LobHandler instance variable of the surrounding class.
| |