hibernate/hibernate-orm · error · HibernateException

Fetch profile [%s] specified an association that does not ex

Error message

Fetch profile [%s] specified an association that does not exist - %s

What it means

Error "Fetch profile [%s] specified an association that does not exist - %s" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java:96

			}

			// then register the association with the FetchProfile
			fetchProfile.addFetch( new Fetch( association, fetchStyle, fetchTiming ) );
		}
		return fetchProfile;
	}

	private static FetchStyle fetchStyle(FetchMode fetchMode) {
		return switch ( fetchMode ) {
			case JOIN -> FetchStyle.JOIN;
			case SELECT -> FetchStyle.SELECT;
			case SUBSELECT -> FetchStyle.SUBSELECT;
		};
	}

	private static void validateFetchablePart(ModelPart fetchablePart, String profileName, Association association) {
		if ( fetchablePart == null ) {
			throw new HibernateException( String.format(
					"Fetch profile [%s] specified an association that does not exist - %s",
					profileName,
					association.getRole()
			) );
		}

		if ( !isAssociation( fetchablePart ) ) {
			throw new HibernateException( String.format(
					"Fetch profile [%s] specified an association that is not an association - %s",
					profileName,
					association.getRole()
			) );
		}
	}

	private static boolean isAssociation(ModelPart fetchablePart) {
		return fetchablePart instanceof EntityValuedModelPart
			|| fetchablePart instanceof PluralAttributeMapping;

View on GitHub (pinned to fad1729dce)

Solutions

  1. Correct the association path in the @FetchProfile fetch override so it refers to an existing association.

When it happens

Trigger: Thrown when a @FetchProfile declares a fetch that cannot be resolved against the entity mapping.

Common situations: Typical situations: the fetch profile names a property that does not exist or is not an association; the entity reference in the profile is misspelled or unmapped.


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