hibernate/hibernate-orm · error · UnsupportedOperationException
Fetch profiles are not supported for mutation queries
Error message
Fetch profiles are not supported for mutation queries
What it means
UnsupportedOperationException guard: enableFetchProfile was called on a mutation query; fetch profiles affect entity loading and do not apply to insert/update/delete statements.
Solutions
- Fetch profiles cannot be applied to mutation queries. Remove the fetch profile enablement for the mutation.
Defensive patterns
Strategy: validation
When it happens
Trigger: An entity graph or fetch profile is applied where unsupported: Fetch profiles are not supported for mutation queries
Common situations: Setting fetch graphs/load graphs or fetch profiles on mutation queries, or referencing an undefined fetch profile name.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/d43cc670f0861cf5.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/MutationQueryImpl.java:602
@Override
protected void applyFollowOnStrategyHint(Object value) {
irrelevantHint( "Locking" );
}
@Override
@Deprecated
@SuppressWarnings("removal")
@Nonnull
public Query<T> setEntityGraph(@Nonnull EntityGraph<? super T> graph, @Nonnull GraphSemantic semantic) {
throw new UnsupportedOperationException( "Entity graphs are not supported for mutation queries" );
}
@Override
@SuppressWarnings("removal")
@Nonnull
public Query<T> enableFetchProfile(@Nonnull String profileName) {
throw new UnsupportedOperationException( "Fetch profiles are not supported for mutation queries" );
}
@Override
@SuppressWarnings("removal")
@Nonnull
public Query<T> disableFetchProfile(@Nonnull String profileName) {
throw new UnsupportedOperationException( "Fetch profiles are not supported for mutation queries" );
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Parameter handling
@Override
@Nonnull
public ParameterMetadataImplementor getParameterMetadata() {
return parameterMetadata;
}
@OverrideView on GitHub (pinned to fad1729dce)