hibernate/hibernate-orm · error · HibernateException
Fetch profile [%s] specified an association that is not an a
Error message
Fetch profile [%s] specified an association that is not an association - %s
What it means
Error "Fetch profile [%s] specified an association that is not an association - %s" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java:104
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;
}
private static EntityPersister getEntityPersister(
MappingMetamodel mappingMetamodel,
FetchProfile fetchProfile,
org.hibernate.mapping.FetchProfile.Fetch mappingFetch) {
final String entityName = mappingMetamodel.getImportedName( mappingFetch.getEntity() );
if ( entityName != null ) {View on GitHub (pinned to fad1729dce)
Solutions
- Point the fetch profile at a real association (to-one/to-many), not a basic attribute.
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/e7889ae7c36b089e.
Report an issue: GitHub.