hibernate/hibernate-orm · error · HibernateException

Unable to resolve entity reference

Error message

Unable to resolve entity reference [{}] in fetch profile [{}]

What it means

Bootstrap-time lookup failure in FetchProfileHelper.getEntityPersister: the entity name referenced by a fetch-profile fetch cannot be resolved to a known entity in the mapping metamodel, so the profile cannot be applied.

Solutions

  1. Check the entity name in the fetch profile for typos and ensure the entity is mapped.
Defensive patterns

Strategy: validation

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/0495ca07edf839e7. Report an issue: GitHub.

Appendix: source

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

	}

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

	private static EntityPersister getEntityPersister(
			MappingMetamodel mappingMetamodel,
			FetchProfile fetchProfile,
			org.hibernate.mapping.FetchProfile.Fetch mappingFetch) {
		final String entityName = mappingMetamodel.getImportedName( mappingFetch.getEntity() );
		if ( entityName != null ) {
			final var persister = mappingMetamodel.getEntityDescriptor( entityName );
			if ( persister != null ) {
				return persister;
			}
		}
		throw new HibernateException( "Unable to resolve entity reference [" + mappingFetch.getEntity()
				+ "] in fetch profile [" + fetchProfile.getName() + "]" );
	}

}

View on GitHub (pinned to fad1729dce)