{"record":{"id":"5a1e19dd33084296","repo":"hibernate/hibernate-orm","slug":"the-from-clause-of-a-set-returning-function-has","errorCode":null,"errorMessage":"The 'from' clause of a set returning function has a 'fetch' join","messagePattern":"The 'from' clause of a set returning function has a 'fetch' join","errorType":"exception","errorClass":"SemanticException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":2375,"sourceCode":"\t\t\tif ( getCreationOptions().useStrictJpaCompliance() ) {\n\t\t\t\tthrow new StrictJpaComplianceViolation(\n\t\t\t\t\t\t\"The JPA specification does not support subqueries in the from clause. \" +\n\t\t\t\t\t\t\t\t\"Please disable the JPA query compliance if you want to use this feature.\",\n\t\t\t\t\t\tStrictJpaComplianceViolation.Type.FROM_SUBQUERY\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfinal boolean lateral = joinSubqueryContext.LATERAL() != null;\n\t\t\tfinal var identifierConsumer = dotIdentifierConsumerStack.pop();\n\t\t\tfinal var subQuery = (SqmSubQuery<X>) joinSubqueryContext.subquery().accept( this );\n\t\t\tdotIdentifierConsumerStack.push( identifierConsumer );\n\t\t\tfinal var join = new SqmDerivedJoin<>( subQuery, alias, joinType, lateral, sqmRoot );\n\t\t\tprocessingStateStack.getCurrent().getPathRegistry().register( join );\n\t\t\treturn join;\n\t\t}\n\t\telse if ( joinTargetContext instanceof HqlParser.JoinFunctionContext joinFunctionContext ) {\n\t\t\tif ( fetch ) {\n\t\t\t\tthrow new SemanticException( \"The 'from' clause of a set returning function has a 'fetch' join\", query );\n\t\t\t}\n\t\t\tif ( getCreationOptions().useStrictJpaCompliance() ) {\n\t\t\t\tthrow new StrictJpaComplianceViolation(\n\t\t\t\t\t\t\"The JPA specification does not support functions in the from clause. \" +\n\t\t\t\t\t\t\t\t\"Please disable the JPA query compliance if you want to use this feature.\",\n\t\t\t\t\t\tStrictJpaComplianceViolation.Type.FROM_FUNCTION\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfinal boolean lateral = joinFunctionContext.LATERAL() != null;\n\t\t\tfinal var identifierConsumer = dotIdentifierConsumerStack.pop();\n\t\t\tfinal var function = (SqmSetReturningFunction<?>) joinFunctionContext.setReturningFunction().accept( this );\n\t\t\tdotIdentifierConsumerStack.push( identifierConsumer );\n\t\t\tfinal var join = new SqmFunctionJoin<>(\n\t\t\t\t\tfunction,\n\t\t\t\t\talias,\n\t\t\t\t\tjoinType,\n\t\t\t\t\tlateral,","sourceCodeStart":2357,"sourceCodeEnd":2393,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L2357-L2393","documentation":"Error \"The 'from' clause of a set returning function has a 'fetch' join\" thrown in hibernate/hibernate-orm.","triggerScenarios":"The HQL/JPQL query violates a structural language rule.","commonSituations":"Writing queries with missing select/from, mismatched group by positions, or invalid ordering constructs.","solutions":["Remove the fetch join from the set-returning function's from clause.","Fetch the association in the outer query instead."],"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"}