hibernate/hibernate-orm · error · UnknownProfileException

No fetch profile named '{}'

Error message

No fetch profile named '{}'

What it means

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

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/MultiIdentifierLoadAccessImpl.java:211

				enabledFetchProfiles,
				disabledFetchProfiles,
				// irrelevant for load-by-id
				NaturalIdSynchronization.DISABLED
		);
	}

	@Override
	@SuppressWarnings( "unchecked" )
	public <K> List<T> multiLoad(List<K> ids) {
		return ids.isEmpty()
				? emptyList()
				: buildOperation().performFind( (List<Object>)ids, graphSemantic, rootGraph );
	}

	@Override
	public MultiIdentifierLoadAccess<T> enableFetchProfile(String profileName) {
		if ( !session.getFactory().containsFetchProfileDefinition( profileName ) ) {
			throw new UnknownProfileException( profileName );
		}
		if ( enabledFetchProfiles == null ) {
			enabledFetchProfiles = new HashSet<>();
		}
		enabledFetchProfiles.add( profileName );
		if ( disabledFetchProfiles != null ) {
			disabledFetchProfiles.remove( profileName );
		}
		return this;
	}

	@Override
	public MultiIdentifierLoadAccess<T> disableFetchProfile(String profileName) {
		if ( disabledFetchProfiles == null ) {
			disabledFetchProfiles = new HashSet<>();
		}
		disabledFetchProfiles.add( profileName );
		if ( enabledFetchProfiles != null ) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Define the fetch profile with @FetchProfile, or fix the profile name.
  2. Or remove the enableFetchProfile call.

When it happens

Trigger: Thrown when enabling a fetch profile that was never declared with @FetchProfile on the SessionFactory.

Common situations: Typical situations: misspelled profile name; the @FetchProfile annotation missing or on an entity not scanned; calling enableFetchProfile with a profile defined in another persistence unit.


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