Interface ProcedureCall

All Superinterfaces:
AutoCloseable, CommonQueryContract, Query, StoredProcedureQuery, SynchronizeableQuery
All Known Subinterfaces:
ProcedureCallImplementor<R>

public interface ProcedureCall extends CommonQueryContract, SynchronizeableQuery, StoredProcedureQuery
Defines support for executing database stored procedures and functions using the JDBC stored procedure SQL escape syntax.

Here we use the terms "procedure" and "function" as follows:

  • A procedure is a named database executable called via: {call procedureName(...)}
  • A function is a named database executable called via: {? = call functionName(...)}

Unless explicitly specified, the ProcedureCall is executed using the procedure call syntax. To explicitly specify that the function call syntax should be used, call markAsFunctionCall(int). Clients of the JPA-standard StoredProcedureQuery interface may choose between:

When the function call syntax is used:

  • parameters must be registered by position (not name),
  • the first parameter is considered to represent the function return value (corresponding to the ? which occurs before the =), and
  • the first parameter must have mode OUT, INOUT, or REF_CURSOR; IN is illegal.

Depending on the SQL dialect, further constraints are enforced or inferred. For example, on PostgreSQL:

  • If a parameter has mode REF_CURSOR, it's automatically inferred that the call is a function call because this is the only context in which PostgreSQL returns REF_CURSOR results. So it's not necessary to call markAsFunctionCall(int) explicitly.
  • The restriction that there may be at most one REF_CURSOR mode parameter is enforced.
See Also: