Call stored procedure using Spring SimpleJdbcCall with callback
- by MFIhsan
I have an Oracle Stored procedure that takes CLOB input and REFCURSOR output. I invoke the SP via Spring SimpleJdbcCall passing in a RowMapper to map the results.
However, since the result set is large, I need to provide callback feature to the client. I can't quite figure out how to add callback for an SP call using Spring - both with and without SimpleJdbcCall.
One thought I have is to pass-in a RowCallbackHandler. Will this work or is there a better way to solve this problem? Any help here is appreciated.
private Map<String, Object> arguments = ...;
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(this.jdbcTemplate)
.withCatalogName(this.packageName)
.withProcedureName(this.storedProcName)
.withoutProcedureColumnMetaDataAccess()
.declareParameters(this.outputParameters.toArray(new SqlOutParameter[]{}));
if(!isEmpty(inputParameters)) {
jdbcCall.declareParameters(inputParameters.toArray(new SqlParameter[]{}));
}
this.outputParameters.add(new SqlOutParameter(outputParamName, VARCHAR, rowMapper));
jdbcCall.execute(arguments);