在这样的代码中传递给 Spring JDBC lobCreator.setBlobAsBinaryStream(,,) 后是否需要在 java 中手动关闭 InputStream (bean.getContentAsStream())?
getJdbcTemplate().execute(
"INSERT INTO file (" +
"id, " + //1
"FILE_DATA) " + //2
" VALUES (?, ?)",
// lobhandler is instance of org.springframework.jdbc.support.lob.OracleLobHandler
new AbstractLobCreatingPreparedStatementCallback(lobhandler){
@Override
protected void setValues(PreparedStatement ps, LobCreator lobCreator) throws SQLException, DataAccessException {
ps.setString(1, bean.getRecordId());
lobCreator.setBlobAsBinaryStream(ps, 2, bean.getContentAsStream(), (int) bean.getContentSize());
}
});