com.onewebsql.util.jdbc
Class CallableStatementOp<T,IP,OP>

java.lang.Object
  extended by com.onewebsql.util.jdbc.CallableStatementOp<T,IP,OP>
All Implemented Interfaces:
ConnectionOp<T>

public class CallableStatementOp<T,IP,OP>
extends Object
implements ConnectionOp<T>

Provides way to invoke a CallableStatement using JdbcUtil class. The CallableStatement can return its result as ResultSet or as OUT parameter. The class handles both ways:


Constructor Summary
CallableStatementOp(String query, IP inputParameters, OP outputParameters, CallableStatementParameterHandler<IP,OP> callableStatementParameterHandler, CallableStatementHandler<T> callableStatementHandler)
          Constructor.
 
Method Summary
 T invoke(Connection con)
          Invokes a CallableStatement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CallableStatementOp

public CallableStatementOp(String query,
                           IP inputParameters,
                           OP outputParameters,
                           CallableStatementParameterHandler<IP,OP> callableStatementParameterHandler,
                           CallableStatementHandler<T> callableStatementHandler)
Constructor.

Parameters:
query - SQL query
inputParameters - input parameters
outputParameters - output parameters
callableStatementParameterHandler - object which binds IN and OUT paratemeters to the statement
callableStatementHandler - object which returns the result of a statement which returns OUT patameters
Method Detail

invoke

public T invoke(Connection con)
         throws SQLException
Invokes a CallableStatement. If the statement returns a ResultSet then the invoke(Connection) method returns the list of objects created by the method the specified RowHandler from the consecutive rows of the result. If the statement returns an 'OUT' parameter then the invoke(Connection) method returns the result of the method com.onewebsql.util.jdbc.CallableStatementHandler#getObject(CallableStatement) for the specified callableStatementHandler

Specified by:
invoke in interface ConnectionOp<T>
Parameters:
connection - database connection
Returns:
result of the operation
Throws:
SQLException - if an exception is thrown


Copyright © 2011-2013 e-point SA. All Rights Reserved.