This API is used as follows:
org.hibernate.procedure.ProcedureCall is obtained via one of the
overloaded org.hibernate.Session#createStoredProcedureCall methods.
ProcedureCall reference is then used to "configure" the procedure call
(set timeouts and such) and to perform parameter registration.
All procedure parameters that the application wants to use must be registered.
For each IN or INOUT parameter, a value may then be bound.
org.hibernate.procedure.ProcedureCall#getOutputs() }
method. The underlying JDBC call is executed as needed. The pattern to access the returns is
iteration over the outputs while org.hibernate.procedure.ProcedureOutputs#goToNext() }
returns true and calling org.hibernate.procedure.ProcedureOutputs#getCurrent() }
during iteration:
ProcedureCall call = session.createStoredProcedureCall( "some_procedure" );
...
ProcedureOutputs outputs = call.getOutputs();
while ( outputs.goToNext() ) {
final Output output = outputs.getCurrent();
if ( output.isResultSet() ) {
handleResultSetOutput( (ResultSetOutput) output );
}
else {
handleUpdateCountOutput( (UpdateCountOutput) output );
}
}
org.hibernate.procedure.ProcedureOutputs#getOutputParameterValue methods.
For portability amongst databases, it is advised to access the output parameters after all
returns have been processed.
org.hibernate.Session#createStoredProcedureCall(String) , org.hibernate.Session#createStoredProcedureCall(String, Class[]) , org.hibernate.Session#createStoredProcedureCall(String, String...)
| Modifier and Type | Interface and Description |
|---|---|
| public interface | FunctionReturn<T>
Describes the function return for ProcedureCalls that represent calls to
a function ( |
| public interface | ProcedureCall
Defines support for executing database stored procedures and functions. |
| public interface | ProcedureOutputs
Specialization of the |
| Modifier and Type | Class and Description |
|---|---|
| public class | NamedParametersNotSupportedException
Thrown to indicate that an attempt was made to register a stored procedure named parameter, but the underlying database reports to not support named parameters. |
| public class | |
| public class | ParameterMisuseException
Thrown to indicate a misuse of a parameter |
| public class | |
| public class | ParameterTypeException
Indicates Hibernate is unable to determine the type details for a parameter. |