hibernate/hibernate-orm · error · AnnotationException
Attribute '${attributeName}' is annotated '@Fetch' for an un
Error message
Attribute '${attributeName}' is annotated '@Fetch' for an unknown entity graph '${graphName}' What it means
Error "Attribute '${attributeName}' is annotated '@Fetch' for an unknown entity graph '${graphName}'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java:1775
options.add( FetchHintOptions.from( fetch.hints() ) );
}
return options;
}
private void validateFetchGraphNames(
List<FetchGraphContribution> fetchGraphContributions,
List<NamedEntityGraph> jpaNamedGraphs) {
if ( fetchGraphContributions.isEmpty() ) {
return;
}
final var jpaGraphNames = new HashSet<String>();
for ( var jpaNamedGraph : jpaNamedGraphs ) {
final String explicitName = jpaNamedGraph.name();
jpaGraphNames.add( StringHelper.isNotEmpty( explicitName ) ? explicitName : name );
}
for ( var fetchGraphContribution : fetchGraphContributions ) {
if ( !jpaGraphNames.contains( fetchGraphContribution.graphName() ) ) {
throw new AnnotationException(
"Attribute '" + fetchGraphContribution.attributeName()
+ "' is annotated '@Fetch' for an unknown entity graph '"
+ fetchGraphContribution.graphName() + "'" );
}
}
}
private void processParsedNamedEntityGraph(org.hibernate.annotations.NamedEntityGraph annotation) {
if ( annotation != null ) {
getMetadataCollector()
.addNamedEntityGraph( namedEntityGraphDefinition( annotation ) );
}
}
private NamedEntityGraphDefinition namedEntityGraphDefinition(org.hibernate.annotations.NamedEntityGraph annotation) {
final String explicitName = annotation.name();
return new NamedEntityGraphDefinition(
StringHelper.isNotEmpty( explicitName ) ? explicitName : persistentClass.getJpaEntityName(),View on GitHub (pinned to fad1729dce)
Solutions
- Correct the entity graph name in @Fetch to a graph defined on the entity, or define the graph.
When it happens
Trigger: An association or reference targets a type that Hibernate has not mapped as an entity.
Common situations: Missing @Entity on the target class, the class not being scanned into the persistence unit, or a typo in the entity name.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/3c1bcdfe59cc235f.
Report an issue: GitHub.