Hello,
We're calling a stored procedure with StoredProcedureItemReader (Spring Batch 2.1.0.RELEASE).
When the stored procedure fails it returns the error message as an OUT parameter (and not as a SQL Error Code).
The stored procedure resides on mainframe system and already exists (so we cannot ask for a modification).
How can we get an OUT value outside of the refCursor ?
For the moment, we have modified StoredProcedureItemReader.openCursor method in order to retrieve the callableStatement just after the callableStatement.execute().
We added our method afterCallableStatementExecution.
So we have :
And if we want to handle OUT values, we just need to inherit from our StoredProcedureItemReader and override afterCallableStatementExecution method.Code:public class StoredProcedureItemReader<T> extends AbstractCursorItemReader<T> protected void openCursor(Connection con) { .... boolean results = callableStatement.execute(); afterCallableStatementExecution(callableStatement); if (results) { .... } protected void afterCallableStatementExecution(CallableStatement aCallableStatement) throws SQLException { } }
Is there a better method ?
If no, could you integrate this feature into Spring Batch (should I open a JIRA issue) ?
Thanks very much


Reply With Quote