{"record":{"id":"30f02879b502a5d0","repo":"hibernate/hibernate-orm","slug":"encountered-implicit-from-clause-but-strict-jpq","errorCode":null,"errorMessage":"Encountered implicit 'from' clause, but strict JPQL compliance was requested","messagePattern":"Encountered implicit 'from' clause, but strict JPQL compliance was requested","errorType":"exception","errorClass":"StrictJpaComplianceViolation","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":1230,"sourceCode":"\n\t\tif ( groupByClauseContext != null ) {\n\t\t\tsqmQuerySpec.setGroupByClauseExpressions( visitGroupByClause( groupByClauseContext ) );\n\t\t}\n\t\tif ( havingClauseContext != null ) {\n\t\t\tsqmQuerySpec.setHavingClausePredicate( visitHavingClause( havingClauseContext ) );\n\t\t}\n\n\t\treturn sqmQuerySpec;\n\t}\n\n\tprivate SqmFromClause buildInferredFromClause(HqlParser.SelectClauseContext selectClauseContext) {\n\t\tif ( selectClauseContext != null || processingStateStack.depth() > 1  ) {\n\t\t\t// when there's an explicit 'select', or in a subquery, we never infer the 'from'\n\t\t\treturn new SqmFromClause();\n\t\t}\n\t\telse {\n\t\t\tif ( creationOptions.useStrictJpaCompliance() ) {\n\t\t\t\tthrow new StrictJpaComplianceViolation(\n\t\t\t\t\t\t\"Encountered implicit 'from' clause, but strict JPQL compliance was requested\",\n\t\t\t\t\t\tStrictJpaComplianceViolation.Type.IMPLICIT_FROM\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tfinal var fromClause = new SqmFromClause();\n\t\t\tfinal var entityDescriptor = getResultEntity();\n\t\t\tif ( entityDescriptor != null ) {\n\t\t\t\tfinal SqmRoot<R> sqmRoot =\n\t\t\t\t\t\tnew SqmRoot<>( entityDescriptor, \"_0\", false, nodeBuilder() );\n\t\t\t\tprocessingStateStack.getCurrent().getPathRegistry().register( sqmRoot );\n\t\t\t\tfromClause.addRoot( sqmRoot );\n\t\t\t}\n\t\t\treturn fromClause;\n\t\t}\n\t}\n\n\tprivate EntityDomainType<R> getResultEntity() {","sourceCodeStart":1212,"sourceCodeEnd":1248,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L1212-L1248","documentation":"Error \"Encountered implicit 'from' clause, but strict JPQL compliance was requested\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An HQL extension is used while strict JPQL compliance is enabled.","commonSituations":"Running HQL-specific syntax (CTEs, limit/offset, collection functions) with hibernate.jpa.compliance.query=true.","solutions":["Add an explicit 'from' clause to the query.","Disable strict JPQL compliance if implicit from is intended."],"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"}