hibernate/hibernate-orm · error · ExecutionException
Error extracting procedure output parameter value [" + param
Error message
Error extracting procedure output parameter value [" + parameter + "]
What it means
This ExecutionException is a wrapper: after execution, Hibernate asked the JDBC CallableStatement for the output value (via ParameterExtractor or RefCursorExtractor) and the driver threw. The real reason is in the cause — typical cases are reading an output parameter before all result sets/update counts are consumed, a Java type registered that the SQL type won't coerce to, or REF_CURSOR extraction when the statement does not supply a result set.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/procedure/internal/OutputsImpl.java:144
try {
if ( registration.getParameterMode() == ParameterMode.REF_CURSOR ) {
//noinspection unchecked
return (T) registration.getRefCursorExtractor().extractResultSet(
jdbcStatement,
procedureCall.getSession()
);
}
else {
//noinspection unchecked
return (T) registration.getParameterExtractor().extractValue(
jdbcStatement,
parameter.getPosition() == null,
procedureCall.getSession()
);
}
}
catch (Exception e) {
throw new ExecutionException(
"Error extracting procedure output parameter value [" + parameter + "]",
e
);
}
}
@Override
public Object getOutputParameterValue(String name) {
return getOutputParameterValue( procedureCall.getParameterMetadata().getQueryParameter( name ) );
}
@Override
public Object getOutputParameterValue(int position) {
return getOutputParameterValue( procedureCall.getParameterMetadata().getQueryParameter( position ) );
}
@OverrideView on GitHub (pinned to fad1729dce)
Solutions
- Call execute() first and consume all results (hasMoreResults()/getResultList()/getUpdateCount loop) before reading output parameters.
- Unwrap the ExecutionException's cause and fix the registered Java type to match the SQL OUT type.
- For REF_CURSOR parameters, register java.sql.ResultSet (ParameterMode.REF_CURSOR) and read it while the statement is open.
Example fix
// before
proc.execute();
Object v = proc.getOutputParameterValue("status"); // driver fails mid-extraction
// after
proc.execute();
while (proc.hasMoreResults()) { proc.getResultList(); } // drain results first
Object v = proc.getOutputParameterValue("status"); Defensive patterns
Strategy: try-catch
Validate before calling
// ensure execute() has run and results are drained before extraction
boolean executed = proc.execute();
while ( proc.hasMoreResults() ) {
proc.getResultList();
}
if ( proc.getUpdateCount() != -1 ) { /* update count consumed */ }
Object value = proc.getOutputParameterValue( name ); Try / catch
try {
Object v = proc.getOutputParameterValue( name );
} catch (org.hibernate.ExecutionException e) {
Throwable cause = e.getCause(); // the actual SQLException / driver failure
log.warn( "output parameter [{}] extraction failed: {}", name, cause.getMessage() );
throw new IllegalStateException( "procedure " + proc.getProcedureName() + " output failed", cause );
} Prevention
- Always call execute() and drain result sets before reading output parameters.
- Register the exact Java type matching the SQL OUT type.
- Log the cause chain, not the wrapper message, when diagnosing extraction failures.
When it happens
Trigger: getOutputParameterValue(...) before execute() completes or before draining returned result sets; registering e.g. String.class for a NUMBER OUT parameter; extracting a REF_CURSOR after the statement/cursor was closed; calling extraction twice on drivers that invalidate the value.
Common situations: PostgreSQL/Oracle ordering rules (output values valid only after results are drained); type guesses during schema evolution (column widened to NUMBER); long-running procedures where the driver times out and the CallableStatement is unusable.
Related errors
- JDBC driver does not support named parameters for setArray.
- Unexpected error extracting REF_CURSOR parameter [{}]
- IN parameter not valid for output extraction
- Parameter [" + parameter + "] is not registered with this pr
- Dialect [" + dialect.getClass().getName() + "] not known to
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/77d9b40cbf7739ac.
Report an issue: GitHub.