hibernate/hibernate-orm · error · UnsupportedOperationException
Entity graphs are not supported for mutation queries
Error message
Entity graphs are not supported for mutation queries
What it means
UnsupportedOperationException guard: setEntityGraph was called on a mutation query; entity graphs only influence result fetching and are meaningless for insert/update/delete statements.
Solutions
- Entity graphs cannot be applied to mutation queries. Remove the entity graph hint from the update/delete query.
Defensive patterns
Strategy: validation
When it happens
Trigger: An entity graph or fetch profile is applied where unsupported: Entity graphs 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/37e7b4e93fb5ff83.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/query/internal/MutationQueryImpl.java:595
// else, per spec, just ignore this
}
@Override
protected void applyLockTimeoutHint(String hintName, Object timeout) {
irrelevantHint( "Locking" );
}
@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 handlingView on GitHub (pinned to fad1729dce)