hibernate/hibernate-orm · error · AnnotationException

Property '${property}' refers to an unknown fetch profile na

Error message

Property '${property}' refers to an unknown fetch profile named '${profileName}'

What it means

Error "Property '${property}' refers to an unknown fetch profile named '${profileName}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/FetchSecondPass.java:45

	private final MetadataBuildingContext buildingContext;

	public FetchSecondPass(
			FetchProfileOverride fetch,
			PropertyHolder propertyHolder,
			String propertyName,
			MetadataBuildingContext buildingContext) {
		this.fetch = fetch;
		this.propertyHolder = propertyHolder;
		this.propertyName = propertyName;
		this.buildingContext = buildingContext;
	}

	@Override
	public void doSecondPass(Map<String, PersistentClass> persistentClasses) throws MappingException {
		final String profileName = fetch.profile();
		final var profile = buildingContext.getMetadataCollector().getFetchProfile( profileName );
		if ( profile == null ) {
			throw new AnnotationException(
					"Property '" + qualify( propertyHolder.getPath(), propertyName )
							+ "' refers to an unknown fetch profile named '" + profileName + "'"
			);
		}

		if ( profile.getSource() == ANNOTATIONS ) {
			profile.addFetch( new FetchProfile.Fetch(
					propertyHolder.getEntityName(),
					propertyName,
					fetch.mode(),
					fetch.fetch()
			) );
		}
		// otherwise, it's a fetch profile defined in XML, and it overrides
		// the annotations, so we simply ignore this annotation completely
	}
}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Correct the fetch profile name, or define the profile with @FetchProfile.

When it happens

Trigger: A named entity graph / fetch declaration references unknown or incompatible types, attributes, or subgraphs.

Common situations: @Fetch pointing at an unknown graph, subgraph types that are not subtypes of the attribute type, or conflicting fetch options for the same attribute.


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