hibernate/hibernate-orm · error · IllegalOutputTypeException
Cannot treat ResultSetOutput as UpdateCountOutput
Error message
Cannot treat ResultSetOutput as UpdateCountOutput
What it means
Error "Cannot treat ResultSetOutput as UpdateCountOutput" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/procedure/ResultSetOutput.java:26
/// Models a [java.sql.ResultSet] as an Output.
///
/// @author Steve Ebersole
public interface ResultSetOutput<T> extends Output {
/// Consume the underlying [java.sql.ResultSet] and return the resulting List.
List<T> getResultList();
/// Consume the underlying [java.sql.ResultSet] with the expectation that there is just a single result.
Object getSingleResult();
@Override
default ResultSetOutput<?> asResultSetOutput() {
return this;
}
@Override
default UpdateCountOutput asUpdateCountOutput() {
throw new IllegalOutputTypeException( "Cannot treat ResultSetOutput as UpdateCountOutput" );
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Check the output type before casting: use outputs.getCurrent() instanceof UpdateCountOutput.
- Consume result-set outputs before expecting an update count.
When it happens
Trigger: An API operation is invoked on an object that does not support it.
Common situations: Using query/procedure/proxy APIs beyond their supported feature set (e.g. scrolling, locking, unwrapping a procedure call).
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/edfa7fbefb075803.
Report an issue: GitHub.