public
classAbstractLobStreamingResultSetExtractor
implements
ResultSetExtractor
Overview
Inheritance
Members
Usage
Source
Books
Since1.0.2
VersionNot specified.
Author(s)Juergen Hoeller
Abstract ResultSetExtractor implementation that assumes streaming of LOB data.
Typically used as inner class, with access to surrounding method arguments.
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);
}
}
);
Delegates to the
streamDatatemplate 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); } } );