{"record":{"id":"0b2172a3b484d9c5","repo":"hibernate/hibernate-orm","slug":"can-t-emulate-on-error-clause-on-cockroachdb-0b2172","errorCode":null,"errorMessage":"Can't emulate on error clause on CockroachDB","messagePattern":"Can't emulate on error clause on CockroachDB","errorType":"exception","errorClass":"QueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonTableFunction.java","lineNumber":145,"sourceCode":"\t\t\t\tif ( isArray ) {\n\t\t\t\t\tsqlAppender.appendSql( \") with ordinality t\" );\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsqlAppender.appendSql( \",1)) t\" );\n\t\t\t\t}\n\t\t\t\tsqlAppender.appendSql( clauseLevel + 1 );\n\t\t\t\tsqlAppender.appendSql( \"(d,i) on true\" );\n\t\t\t\tnextClauseLevel = renderNestedColumnJoins( sqlAppender, nestedColumnDefinition.columns(), clauseLevel + 1, walker );\n\t\t\t}\n\t\t}\n\t\treturn nextClauseLevel;\n\t}\n\n\t@Override\n\tprotected void renderJsonExistsColumnDefinition(SqlAppender sqlAppender, JsonTableExistsColumnDefinition definition, int clauseLevel, SqlAstTranslator<?> walker) {\n\t\t// jsonb_path_exists errors by default\n\t\tif ( definition.errorBehavior() != null && definition.errorBehavior() != JsonExistsErrorBehavior.ERROR ) {\n\t\t\tthrow new QueryException( \"Can't emulate on error clause on CockroachDB\" );\n\t\t}\n\t\tfinal String jsonPath = definition.jsonPath() == null\n\t\t\t\t? \"$.\" + definition.name()\n\t\t\t\t: definition.jsonPath();\n\t\tCockroachDBJsonExistsFunction.appendJsonExists(\n\t\t\t\tsqlAppender,\n\t\t\t\tnew ClauseLevelDocumentExpression( clauseLevel ),\n\t\t\t\tJsonPathHelper.parseJsonPathElements( jsonPath ),\n\t\t\t\ttrue,\n\t\t\t\tnull,\n\t\t\t\twalker\n\t\t);\n\t\tsqlAppender.appendSql( ' ' );\n\t\tsqlAppender.appendSql( definition.name() );\n\t}\n\n\t@Override\n\tprotected void renderJsonQueryColumnDefinition(SqlAppender sqlAppender, JsonTableQueryColumnDefinition definition, int clauseLevel, SqlAstTranslator<?> walker) {","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonTableFunction.java#L127-L163","documentation":"Error \"Can't emulate on error clause on CockroachDB\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Can't emulate on error clause on CockroachDB.","commonSituations":"Common when running against a database whose dialect lacks this capability, when a mapping or HQL/Criteria query requests unsupported functionality, or when the wrong dialect is configured for the database in use. Error: Can't emulate on error clause on CockroachDB.","solutions":["Remove the ON ERROR clause for CockroachDB."],"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"}