{"record":{"id":"6ef55cce9b876048","repo":"hibernate/hibernate-orm","slug":"insert-conflict-do-update-clause-with-constraint-6ef55c","errorCode":null,"errorMessage":"Insert conflict 'do update' clause with constraint name is not supported","messagePattern":"Insert conflict 'do update' clause with constraint name is not supported","errorType":"exception","errorClass":"IllegalQueryOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/HANASqlAstTranslator.java","lineNumber":148,"sourceCode":"\t\t\telse {\n\t\t\t\tvisitFromClause( statement.getFromClause() );\n\t\t\t}\n\t\t}\n\t}\n\n\t@Override\n\tprotected void renderDmlTargetTableExpression(NamedTableReference tableReference) {\n\t\tsuper.renderDmlTargetTableExpression( tableReference );\n\t\tif ( getClauseStack().getCurrent() != Clause.INSERT ) {\n\t\t\trenderTableReferenceIdentificationVariable( tableReference );\n\t\t}\n\t}\n\n\t@Override\n\tprotected void visitConflictClause(ConflictClause conflictClause) {\n\t\tif ( conflictClause != null ) {\n\t\t\tif ( conflictClause.isDoUpdate() && conflictClause.getConstraintName() != null ) {\n\t\t\t\tthrow new IllegalQueryOperationException( \"Insert conflict 'do update' clause with constraint name is not supported\" );\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected boolean shouldEmulateFetchClause(QueryPart queryPart) {\n\t\t// HANA only supports the LIMIT + OFFSET syntax but also window functions\n\t\t// Check if current query part is already row numbering to avoid infinite recursion\n\t\treturn useOffsetFetchClause( queryPart ) && getQueryPartForRowNumbering() != queryPart\n\t\t\t\t&& !isRowsOnlyFetchClauseType( queryPart );\n\t}\n\n\t@Override\n\tprotected boolean isCorrelated(CteStatement cteStatement) {\n\t\t// Report false here, because apparently HANA does not need the \"lateral\" keyword to correlate a from clause subquery in a subquery\n\t\treturn false;\n\t}\n\n\t@Override","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/HANASqlAstTranslator.java#L130-L166","documentation":"Error \"Insert conflict 'do update' clause with constraint name is not supported\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Thrown at hibernate-core/src/main/java/org/hibernate/dialect/sql/ast/HANASqlAstTranslator.java:148 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use the primary key conflict target instead of a named constraint on SAP HANA","Rewrite the upsert to reference a column list rather than a constraint name"],"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"}