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

Error "Fetch profiles are not supported for mutation queries" thrown in hibernate/hibernate-orm.

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;
	}

	@Override

View on GitHub (pinned to fad1729dce)

Solutions

  1. Fetch profiles cannot be applied to mutation queries. Remove the fetch profile enablement for the mutation.

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.