{"record":{"id":"c55965f0cca4d785","repo":"hibernate/hibernate-orm","slug":"unexpected-statement-type-not-insert-update-del","errorCode":null,"errorMessage":"Unexpected statement type [not INSERT, UPDATE, DELETE or SELECT] : \" + ctx.getText()","messagePattern":"Unexpected statement type \\[not INSERT, UPDATE, DELETE or SELECT\\] : \" \\+ ctx\\.getText\\(\\)","errorType":"exception","errorClass":"ParsingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java","lineNumber":497,"sourceCode":"\t\t\t\tfinal var selectStatement = visitSelectStatement( selectStatementContext );\n\t\t\t\tselectStatement.getQueryPart().validateQueryStructureAndFetchOwners();\n\t\t\t\treturn selectStatement;\n\t\t\t}\n\t\t\telse if ( parseTree instanceof HqlParser.InsertStatementContext insertStatementContext ) {\n\t\t\t\treturn visitInsertStatement( insertStatementContext );\n\t\t\t}\n\t\t\telse if ( parseTree instanceof HqlParser.UpdateStatementContext updateStatementContext ) {\n\t\t\t\treturn visitUpdateStatement( updateStatementContext );\n\t\t\t}\n\t\t\telse if ( parseTree instanceof HqlParser.DeleteStatementContext deleteStatementContext ) {\n\t\t\t\treturn visitDeleteStatement( deleteStatementContext );\n\t\t\t}\n\t\t}\n\t\tfinally {\n\t\t\tparameterDeclarationContextStack.pop();\n\t\t}\n\n\t\tthrow new ParsingException( \"Unexpected statement type [not INSERT, UPDATE, DELETE or SELECT] : \" + ctx.getText() );\n\t}\n\n\n\t// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\t// Top-level statements\n\n\t@Override\n\tpublic SqmSelectStatement<R> visitSelectStatement(HqlParser.SelectStatementContext ctx) {\n\t\tfinal var queryExpressionContext = ctx.queryExpression();\n\t\tfinal SqmSelectStatement<R> selectStatement = new SqmSelectStatement<>( nodeBuilder() );\n\n\t\tparameterCollector = selectStatement;\n\n\t\tprocessingStateStack.push(\n\t\t\t\tnew SqmQueryPartCreationProcessingStateStandardImpl(\n\t\t\t\t\t\tprocessingStateStack.getCurrent(),\n\t\t\t\t\t\tselectStatement,\n\t\t\t\t\t\tthis","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java#L479-L515","documentation":"Error \"Unexpected statement type [not INSERT, UPDATE, DELETE or SELECT] : \" + ctx.getText()\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A runtime precondition of the Hibernate API is violated.","commonSituations":"Occurs when application code or configuration does not satisfy the documented contract of the API being called.","solutions":["Ensure the HQL starts with select, insert, update, or delete.","Fix the query syntax; it could not be classified as a known statement type."],"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"}