The default pureQuery behavior with SQL stored procedure calls is to return the results in an instance of StoredProcedureResult. Additionally, by default pureQuery updates maps and beans that were passed to an annotated or inline method to represent OUT and INOUT parameters.
T handleCall (CallableStatement cstmt, Object... parameters) throws SQLException
pureQuery calls the handleCall() method to create the object that is returned from an annotated or inline method. When pureQuery calls this method, it passes an object that implements the java.sql.CallableStatement interface, which it used to run the SQL CALL statement. pureQuery also passes parameters that you used to pass the values of the parameters in the CALL statement.
There are two methods that you can use to call CallHandlerWithParameter objects from annotated methods.
@Call(sql = "{?1 = Call ADDEM (?1.added1, ?1.addend2, ?1.sum)}")
@Handler(callHandlerWithParameters = customHandlers.GetAddEmResult_CallHandlerWithParameters.class)
public MyResultsBean spResults(AddEm_Parameters parms);
When you specify a handler as a parameter, the parameter must be the last parameter in the method signature. If you specify a CallHandlerWithParameters together with a ParameterHandler as parameters, the handlers must be the last two parameters in the method signature.
For example, in an interface you could define an annotated method that calls a specific type of CallHandlerWithParameters:@Call(sql = "{?1 = Call ADDEM (?1.added1, ?1.addend2, ?1.sum)}")
public MyResultsBean spResults(AddEm_Parameters parms, GetAddEmResult_CallHandlerWithParameters c);
You could invoke the method like this:
MyResultsBean results = face.spResults(parmsObject, new GetAddEmResult_CallHandlerWithParameters());
You pass CallHandlerWithParameters<CAL> objects to this version of the overloaded call() method in the Data interface:
<CAL> T call(String sql, CallHandlerWithParameters<CAL> callHandlerWithParameters, Object... parameters)
Here is an example:
MyResultsBean spResults = db.call("{?1 = Call ADDEM (?1.added1, ?1.addend2, ?1.sum)}",
new custom.GetAddEmResult_CallHandlerWithParameters(), int outVal, int inVal1, int inVal2, int inVal3)