{"record":{"id":"e582840cc868043f","repo":"hibernate/hibernate-orm","slug":"can-t-emulate-null-on-error-clause-on-cockroachdb","errorCode":null,"errorMessage":"Can't emulate null on error clause on CockroachDB","messagePattern":"Can't emulate null 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":47,"sourceCode":"\n/**\n * CockroachDB json_table function.\n */\npublic class CockroachDBJsonTableFunction extends PostgreSQLJsonTableFunction {\n\n\tpublic CockroachDBJsonTableFunction(TypeConfiguration typeConfiguration) {\n\t\tsuper( typeConfiguration );\n\t}\n\n\t@Override\n\tprotected void renderJsonTable(\n\t\t\tSqlAppender sqlAppender,\n\t\t\tJsonTableArguments arguments,\n\t\t\tAnonymousTupleTableGroupProducer tupleType,\n\t\t\tString tableIdentifierVariable,\n\t\t\tSqlAstTranslator<?> walker) {\n\t\tif ( arguments.errorBehavior() == JsonTableErrorBehavior.NULL ) {\n\t\t\tthrow new QueryException( \"Can't emulate null on error clause on CockroachDB\" );\n\t\t}\n\t\tfinal SqlAstNode jsonPathExpression = arguments.jsonPath();\n\t\tfinal List<JsonPathHelper.JsonPathElement> jsonPathElements;\n\t\tfinal boolean isArray;\n\t\tif ( jsonPathExpression == null ) {\n\t\t\tjsonPathElements = Collections.emptyList();\n\t\t\t// Assume array by default\n\t\t\tisArray = true;\n\t\t}\n\t\telse {\n\t\t\tfinal String jsonPath;\n\t\t\ttry {\n\t\t\t\tjsonPath = walker.getLiteralValue( arguments.jsonPath() );\n\t\t\t}\n\t\t\tcatch (Exception ex) {\n\t\t\t\tthrow new QueryException( \"CockroachDB json_table only support literal json paths, but got \" + arguments.jsonPath() );\n\t\t\t}\n\t\t\tisArray = jsonPath.endsWith( \"[*]\" );","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonTableFunction.java#L29-L65","documentation":"Error \"Can't emulate null 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 null 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 null on error clause on CockroachDB.","solutions":["Remove the NULL 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"}