hibernate/hibernate-orm · error · IllegalQueryOperationException
Insert conflict 'do update' clause with constraint name is n
Error message
Insert conflict 'do update' clause with constraint name is not supported
What it means
Error "Insert conflict 'do update' clause with constraint name is not supported" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/H2SqlAstTranslator.java:192
else {
super.visitUpdateStatementOnly( statement );
}
}
@Override
protected void renderDmlTargetTableExpression(NamedTableReference tableReference) {
super.renderDmlTargetTableExpression( tableReference );
if ( getClauseStack().getCurrent() != Clause.INSERT ) {
renderTableReferenceIdentificationVariable( tableReference );
}
}
@Override
protected void visitConflictClause(ConflictClause conflictClause) {
if ( conflictClause != null
&& conflictClause.isDoUpdate()
&& conflictClause.getConstraintName() != null ) {
throw new IllegalQueryOperationException(
"Insert conflict 'do update' clause with constraint name is not supported" );
}
}
@Override
public void visitCteContainer(CteContainer cteContainer) {
// H2 has various bugs in different versions that make it impossible to use CTEs with parameters reliably
withParameterRenderingMode(
SqlAstNodeRenderingMode.INLINE_PARAMETERS,
() -> super.visitCteContainer( cteContainer )
);
}
@Override
protected boolean needsCteInlining() {
// CTEs in H2 are just so buggy, that we can't reliably use them
return true;
}View on GitHub (pinned to fad1729dce)
Solutions
- Use the primary key as the conflict target instead of a named constraint on H2
- Rewrite the upsert using a column-list conflict target
When it happens
Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/H2SqlAstTranslator.java:192 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/6d925095933cde36.
Report an issue: GitHub.