{"record":{"id":"3c1bcdfe59cc235f","repo":"hibernate/hibernate-orm","slug":"attribute-attributename-is-annotated-fetch","errorCode":null,"errorMessage":"Attribute '${attributeName}' is annotated '@Fetch' for an unknown entity graph '${graphName}'","messagePattern":"Attribute '(.+?)' is annotated '@Fetch' for an unknown entity graph '(.+?)'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java","lineNumber":1775,"sourceCode":"\t\t\toptions.add( FetchHintOptions.from( fetch.hints() ) );\n\t\t}\n\t\treturn options;\n\t}\n\n\tprivate void validateFetchGraphNames(\n\t\t\tList<FetchGraphContribution> fetchGraphContributions,\n\t\t\tList<NamedEntityGraph> jpaNamedGraphs) {\n\t\tif ( fetchGraphContributions.isEmpty() ) {\n\t\t\treturn;\n\t\t}\n\t\tfinal var jpaGraphNames = new HashSet<String>();\n\t\tfor ( var jpaNamedGraph : jpaNamedGraphs ) {\n\t\t\tfinal String explicitName = jpaNamedGraph.name();\n\t\t\tjpaGraphNames.add( StringHelper.isNotEmpty( explicitName ) ? explicitName : name );\n\t\t}\n\t\tfor ( var fetchGraphContribution : fetchGraphContributions ) {\n\t\t\tif ( !jpaGraphNames.contains( fetchGraphContribution.graphName() ) ) {\n\t\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\t\"Attribute '\" + fetchGraphContribution.attributeName()\n\t\t\t\t\t\t\t\t+ \"' is annotated '@Fetch' for an unknown entity graph '\"\n\t\t\t\t\t\t\t\t+ fetchGraphContribution.graphName() + \"'\" );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate void processParsedNamedEntityGraph(org.hibernate.annotations.NamedEntityGraph annotation) {\n\t\tif ( annotation != null ) {\n\t\t\tgetMetadataCollector()\n\t\t\t\t\t.addNamedEntityGraph( namedEntityGraphDefinition( annotation ) );\n\t\t}\n\t}\n\n\tprivate NamedEntityGraphDefinition namedEntityGraphDefinition(org.hibernate.annotations.NamedEntityGraph annotation) {\n\t\tfinal String explicitName = annotation.name();\n\t\treturn new NamedEntityGraphDefinition(\n\t\t\t\tStringHelper.isNotEmpty( explicitName ) ? explicitName : persistentClass.getJpaEntityName(),","sourceCodeStart":1757,"sourceCodeEnd":1793,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1757-L1793","documentation":"Error \"Attribute '${attributeName}' is annotated '@Fetch' for an unknown entity graph '${graphName}'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An association or reference targets a type that Hibernate has not mapped as an entity.","commonSituations":"Missing @Entity on the target class, the class not being scanned into the persistence unit, or a typo in the entity name.","solutions":["Correct the entity graph name in @Fetch to a graph defined on the entity, or define the graph."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}