1
我想从我的存储过程调用返回的blob流。我正在尝试使用弹簧AbstractLobStreamingResultSetExtractor来完成此操作。从存储过程调用流blob数据
public OutputStream getDocument(final Document doc, final OutputStream outStream) {
SimpleJdbcCall simpleJdbcCall = new SimpleJdbcCall(rdcJdbcTemplate)
.withProcedureName(PROC_NAME)
.withCatalogName(CATALOG_NAME)
.withSchemaName(SCHEMA_NAME).declareParameters(new SqlParameter(DOC_ID_PARAM, OracleTypes.VARCHAR),
new SqlOutParameter(OUT_PARAM, OracleTypes.BLOB , new AbstractLobStreamingResultSetExtractor<Object>(){
@Override
protected void streamData(ResultSet rs) throws SQLException,
IOException, DataAccessException {
InputStream blobStream = lobHandler.getBlobAsBinaryStream(rs, 1);
if (blobStream != null){
FileCopyUtils.copy(blobStream, outStream);
}
}
}));
SqlParameterSource in = new MapSqlParameterSource().addValue(DOC_ID_PARAM, doc.getId());
Map<String,Object> out = simpleJdbcCall.execute(in);
return outStream;
}
当我调试这个streamdata代码永远不会被调用。
任何想法,我可能会实现这个?