public void streamImage(final String name, final OutputStream contentStream) throws DataAccessException {
getJdbcTemplate().query(
"SELECT content FROM imagedb WHERE image_name=?", new Object[] {name},
new AbstractLobStreamingResultSetExtractor() {
protected void handleNoRowFound() throws LobRetrievalFailureException {
throw new EmptyResultDataAccessException(
"Image with name '" + name + "' not found in database", 1);
}
public void streamData(ResultSet rs) throws SQLException, IOException {
InputStream is = lobHandler.getBlobAsBinaryStream(rs, 1);
if (is != null) {