# Class ProcedureAction

java.lang.Object
org.apache.cayenne.access.jdbc.BaseSQLAction
org.apache.cayenne.access.jdbc.ProcedureAction

All Implemented Interfaces:
  `SQLAction`

Direct Known Subclasses:
  `SQLServerProcedureAction`

public class ProcedureAction extends BaseSQLAction
A SQLAction that runs a stored procedure. Note that ProcedureAction has internal state and is not thread-safe.

Since:
  1.2

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected int`
  `processedResultSets`
  Holds a number of ResultSets processed by the action.
  `protected ProcedureQuery`
  `query`

  ### Fields inherited from class BaseSQLAction

  `dataNode`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ProcedureAction(ProcedureQuery query, DataNode dataNode)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `bindParameters(CallableStatement statement, TranslatedProcedure translated)`
  Applies the translated bindings to the CallableStatement: registers OUT parameters and binds IN parameters.
  `protected RSColumn[]`
  `describeResultSet(ResultSet resultSet, int setIndex)`
  Describes the result set columns, resolving an `ExtendedType` for each.
  `protected Procedure`
  `getProcedure()`
  Returns stored procedure for an internal query.
  `protected void`
  `initStatement(CallableStatement statement)`
  `void`
  `performAction(Connection connection, OperationObserver observer)`
  Executes a query using a strategy defined by the implementation.
  `protected void`
  `readProcedureOutParameters(CallableStatement statement, OperationObserver delegate)`
  Helper method that reads OUT parameters of a CallableStatement.

  ### Methods inherited from class BaseSQLAction

  `getInMemoryOffset, readResultSet`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### query

    protected ProcedureQuery query

  - ### processedResultSets

    protected int processedResultSets
    Holds a number of ResultSets processed by the action. This value is reset to zero on every "performAction" call.

- ## Constructor Details

  - ### ProcedureAction

    public ProcedureAction(ProcedureQuery query, DataNode dataNode)
    Since:
      4.0

- ## Method Details

  - ### performAction

    public void performAction(Connection connection, OperationObserver observer) throws Exception
    Description copied from interface: `SQLAction`
    Executes a query using a strategy defined by the implementation.
    Throws:
      `Exception`

  - ### bindParameters

    protected void bindParameters(CallableStatement statement, TranslatedProcedure translated) throws Exception
    Applies the translated bindings to the CallableStatement: registers OUT parameters and binds IN parameters. A stored procedure parameter can be both IN and OUT at the same time.
    Throws:
      `Exception`
    Since:
      5.0

  - ### describeResultSet

    protected RSColumn[] describeResultSet(ResultSet resultSet, int setIndex) throws SQLException
    Describes the result set columns, resolving an `ExtendedType` for each.
    Parameters:
      `resultSet` - JDBC ResultSet
      `setIndex` - a zero-based index of the ResultSet in the query results.
    Throws:
      `SQLException`

  - ### getProcedure

    protected Procedure getProcedure()
    Returns stored procedure for an internal query.

  - ### readProcedureOutParameters

    protected void readProcedureOutParameters(CallableStatement statement, OperationObserver delegate) throws Exception
    Helper method that reads OUT parameters of a CallableStatement.
    Throws:
      `Exception`

  - ### initStatement

    protected void initStatement(CallableStatement statement) throws Exception
    Throws:
      `Exception`