hibernate/hibernate-orm · error · UnknownProfileException

No fetch profile named '${name}'

Error message

No fetch profile named '${name}'

What it means

Error "No fetch profile named '${name}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java:808

	@Override @Deprecated
	@SuppressWarnings("removal")
	@Nonnull
	public NativeQueryImplementor<R> disableFetchProfile(@Nonnull String profileName) {
		queryOptions.disableFetchProfile( profileName );
		return this;
	}

	@Override @Deprecated
	@SuppressWarnings("removal")
	@Nonnull
	public NativeQueryImplementor<R> enableFetchProfile(@Nonnull String profileName) {
		if ( getSessionFactory().containsFetchProfileDefinition( profileName ) ) {
			getQueryOptions().enableFetchProfile( profileName );
			return this;
		}
		else {
			throw new UnknownProfileException( profileName );
		}
	}

	@Override
	public NativeQueryImplementor<R> setPage(Page page) {
		final var limit = queryOptions.getLimit();
		limit.setFirstRow( page.getFirstResult() );
		limit.setMaxRows( page.getMaxResults() );
		return this;
	}

	@Override
	@Nonnull
	public NativeQueryImplementor<R> setFollowOnStrategy(@Nonnull Locking.FollowOn followOnStrategy) {
		//noinspection removal
		queryOptions.getLockOptions().setFollowOnStrategy( followOnStrategy );
		return this;
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. No fetch profile with that name is defined.
  2. Check the name passed to enableFetchProfile against @FetchProfile definitions, or define the fetch profile.

When it happens

Trigger: A name referenced in the query or its configuration cannot be resolved at runtime.

Common situations: Typos in fetch-profile, memento, or table names, or references to objects that were never registered.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/bdf60a9fe879b19f. Report an issue: GitHub.