com.ibm.pdq.runtime.handlers
Interface CallHandler<T>


public interface CallHandler<T>

Processes the results of an SQL stored procedure call and returns an object of type T that describes the results.

Attention: It is recommended that CallHandlerWithParameters<CAL> be used instead of CallHandler<T>.

The default pureQuery behavior for annotated and inline methods executing SQL stored procedure calls is to return all of the query results and OUT and INOUT parameters in an instance of StoredProcedureResult. Additionally, the default behavior is to update Maps and pureQuery beans that were passed to the annotated or inline method to represent OUT and INOUT parameters. For an example, see Data.call(String, Object...). When some other behavior is wanted, an implementation of CallHandlerWithParameters<CAL> or CallHandler<T> can be specified.

Specifying a CallHandler<T> implementation causes its handleCall(CallableStatement) method to be used to process the results of the SQL stored procedure call and to create an object of type T that describes the results. The created object is returned from the associated annotated or inline method. The handleCall method can perform other actions as well.

The object of type T that is returned by CallHandler<T> can contain as much information about the results of the stored procedure call as is wanted. The following examples show possible types for T:

Attention: pureQuery calls cstmt.execute() before calling handleCall(CallableStatement cstmt), so cstmt.execute() must not be called in handleCall (CallableStatement cstmt).

See Also:
Handler.callHandlerWithParameters(), Data.call(String, CallHandler, Object...), StoredProcedureResult, CallHandlerWithParameters

Method Summary

Method Summary
Return Data TypeMethod Name and Description
T handleCall(CallableStatement cstmt)
Processes the results of an SQL stored procedure call and returns an object of type T that describes the results.

Method Detail

handleCall

T handleCall(CallableStatement cstmt)
             throws SQLException
Processes the results of an SQL stored procedure call and returns an object of type T that describes the results.

Attention: pureQuery calls cstmt.execute() before calling handleCall(CallableStatement cstmt), so cstmt.execute() must not be called in handleCall (CallableStatement cstmt).

Parameters:
cstmt - a CallableStatement that represents an SQL stored procedure. When this method is called by pureQuery, cstmt has already been executed.
Returns:
an object of type T that describes the results of the SQL stored procedure call
Throws:
SQLException