hibernate/hibernate-orm · error · ParsingException
Unexpected statement type [not INSERT, UPDATE, DELETE or SEL
Error message
Unexpected statement type [not INSERT, UPDATE, DELETE or SELECT] : " + ctx.getText()
What it means
Error "Unexpected statement type [not INSERT, UPDATE, DELETE or SELECT] : " + ctx.getText()" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java:497
final var selectStatement = visitSelectStatement( selectStatementContext );
selectStatement.getQueryPart().validateQueryStructureAndFetchOwners();
return selectStatement;
}
else if ( parseTree instanceof HqlParser.InsertStatementContext insertStatementContext ) {
return visitInsertStatement( insertStatementContext );
}
else if ( parseTree instanceof HqlParser.UpdateStatementContext updateStatementContext ) {
return visitUpdateStatement( updateStatementContext );
}
else if ( parseTree instanceof HqlParser.DeleteStatementContext deleteStatementContext ) {
return visitDeleteStatement( deleteStatementContext );
}
}
finally {
parameterDeclarationContextStack.pop();
}
throw new ParsingException( "Unexpected statement type [not INSERT, UPDATE, DELETE or SELECT] : " + ctx.getText() );
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Top-level statements
@Override
public SqmSelectStatement<R> visitSelectStatement(HqlParser.SelectStatementContext ctx) {
final var queryExpressionContext = ctx.queryExpression();
final SqmSelectStatement<R> selectStatement = new SqmSelectStatement<>( nodeBuilder() );
parameterCollector = selectStatement;
processingStateStack.push(
new SqmQueryPartCreationProcessingStateStandardImpl(
processingStateStack.getCurrent(),
selectStatement,
thisView on GitHub (pinned to fad1729dce)
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.
When it happens
Trigger: A runtime precondition of the Hibernate API is violated.
Common situations: Occurs when application code or configuration does not satisfy the documented contract of the API being called.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/c55965f0cca4d785.
Report an issue: GitHub.