hibernate/hibernate-orm · error · IllegalStateException
Attempting to get a execute-update a selection query
Error message
Attempting to get a execute-update a selection query
What it means
Error "Attempting to get a execute-update a selection query" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/SelectionQueryImpl.java:1092
if ( keyedPage.getKeyInterpretation() == KEY_OF_FIRST_ON_NEXT_PAGE ) {
// the results come in reverse order
final int pageSize = keyedPage.getPage().getSize();
return results.size() == pageSize + 1
? keyedPage.previousPage( results.get(pageSize - 1).getKey() )
: null;
}
else {
return !results.isEmpty()
? keyedPage.previousPage( results.get(0).getKey() )
: null;
}
}
@Override @Deprecated
@SuppressWarnings({"deprecation", "removal"})
public int executeUpdate() {
final var message = "Attempting to get a execute-update a selection query";
throw new IllegalStateException( message, new IllegalMutationQueryException( message, hql ) );
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// CacheabilityInfluencers
@Override
public Object getQueryStringCacheKey() {
return queryStringCacheKey;
}
@Override
public @Nullable int[] unnamedParameterIndices() {
return QueryHelper.unnamedParameterIndices( domainParameterXref );
}
@Override
@NonnullView on GitHub (pinned to fad1729dce)
Solutions
- executeUpdate() was called on a selection query. Use a mutation query (HQL update/delete/insert) for executeUpdate().
When it happens
Trigger: A runtime precondition of the Hibernate query API is violated: Attempting to get a execute-update a selection query
Common situations: Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/6d31192bf5751b75.
Report an issue: GitHub.