{"record":{"id":"e7c9e0e4b9db8741","repo":"hibernate/hibernate-orm","slug":"expecting-graph-text-to-include-an-entity-name","errorCode":null,"errorMessage":"Expecting graph text to include an entity name : {}","messagePattern":"Expecting graph text to include an entity name : (.+?)","errorType":"exception","errorClass":"InvalidGraphException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/graph/internal/parse/strategy/LegacyGraphParsingStrategy.java","lineNumber":48,"sourceCode":"\t\t\t\tnew CommonTokenStream( new GraphLanguageLexer( CharStreams.fromString( graphText ) ) ) );\n\t\tfinal var graph = parser.graph();\n\t\tif ( graph.typeIndicator() != null ) {\n\t\t\tthrow new InvalidGraphException( \"Expecting graph text to not include an entity name : \" + graphText );\n\t\t}\n\t\treturn parse( entityDomainType, graph.attributeList(), sessionFactory );\n\t}\n\n\t@Override\n\t@Deprecated(forRemoval = true)\n\tpublic <T> RootGraphImplementor<T> parse(String graphText, SessionFactoryImplementor sessionFactory) {\n\t\tif ( graphText == null ) {\n\t\t\treturn null;\n\t\t}\n\t\tfinal var parser = new LegacyGraphLanguageParser(\n\t\t\t\tnew CommonTokenStream( new GraphLanguageLexer( CharStreams.fromString( graphText ) ) ) );\n\t\tfinal var graph = parser.graph();\n\t\tif ( graph.typeIndicator() == null ) {\n\t\t\tthrow new InvalidGraphException( \"Expecting graph text to include an entity name : \" + graphText );\n\t\t}\n\t\tfinal String entityName = graph.typeIndicator().TYPE_NAME().getText();\n\t\t@SuppressWarnings(\n\t\t\t\t\"unchecked\") final EntityDomainType<T> entityType = (EntityDomainType<T>) sessionFactory.getJpaMetamodel()\n\t\t\t\t.entity( entityName );\n\t\treturn parse( entityType, graph.attributeList(), sessionFactory );\n\t}\n\n\t@Override\n\tpublic void parseInto(GraphImplementor<?> graph, String graphText, SessionFactoryImplementor sessionFactory) {\n\t\tfinal var lexer = new GraphLanguageLexer( CharStreams.fromString( graphText ) );\n\t\tfinal var parser = new LegacyGraphLanguageParser( new CommonTokenStream( lexer ) );\n\t\tfinal var graphContext = parser.graph();\n\n\t\tif ( graphContext.typeIndicator() != null ) {\n\t\t\t// todo : throw an exception?  Log warning?  Ignore?\n\t\t\t//\t\tfor now, ignore\n\t\t}","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/graph/internal/parse/strategy/LegacyGraphParsingStrategy.java#L30-L66","documentation":"Error \"Expecting graph text to include an entity name : {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown while parsing entity graph text that does not conform to the expected format for the configured parser mode.","commonSituations":"Typical situations: including an entity name where the legacy strategy forbids it (or omitting it where required); using parse() with the modern parser mode selected.","solutions":["Prefix the graph text with the entity name as required by the legacy graph parser.","Or switch the graph parser mode to match the text format being passed."],"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"}