Call stored procedure using Spring SimpleJdbcCall with callback

Posted by MFIhsan on Stack Overflow See other posts from Stack Overflow or by MFIhsan
Published on 2014-05-31T14:55:53Z Indexed on 2014/05/31 15:26 UTC
Read the original article Hit count: 546

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);

© Stack Overflow or respective owner

Related posts about java

Related posts about spring