hibernate/hibernate-orm · error · IllegalMutationQueryException
Not a mutation query
Error message
Not a mutation query
What it means
Error "Not a mutation query" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/SelectionQueryImpl.java:1630
@Override @Deprecated @SuppressWarnings("deprecation")
@Nonnull
public SelectionQueryImplementor<R> setParameter(int position, @Nullable Calendar value, @Nonnull TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override @Deprecated @SuppressWarnings("deprecation")
@Nonnull
public SelectionQueryImplementor<R> setParameter(int position, @Nullable Date value, @Nonnull TemporalType temporalType) {
super.setParameter( position, value, temporalType );
return this;
}
@Override
@Nonnull
public MutationQueryImplementor<R> asMutationQuery() {
throw new IllegalMutationQueryException( "Not a mutation query", getQueryString() );
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- The query is not a mutation query. Only update/delete/insert queries can be used where a MutationQuery is expected.
When it happens
Trigger: A query is treated as the wrong kind (selection vs mutation): Not a mutation query
Common situations: Unwrapping/casting a SelectionQuery to MutationQuery (or the reverse) when the underlying statement type does not match.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/66886ba6272f9157.
Report an issue: GitHub.