{"record":{"id":"6d41b0618d51814d","repo":"hibernate/hibernate-orm","slug":"can-t-emulate-on-empty-clause-on-cockroachdb","errorCode":null,"errorMessage":"Can't emulate on empty clause on CockroachDB","messagePattern":"Can't emulate on empty clause on CockroachDB","errorType":"exception","errorClass":"QueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonQueryFunction.java","lineNumber":43,"sourceCode":" */\npublic class CockroachDBJsonQueryFunction extends JsonQueryFunction {\n\n\tpublic CockroachDBJsonQueryFunction(TypeConfiguration typeConfiguration) {\n\t\tsuper( typeConfiguration, true, true );\n\t}\n\n\t@Override\n\tprotected void render(\n\t\t\tSqlAppender sqlAppender,\n\t\t\tJsonQueryArguments arguments,\n\t\t\tReturnableType<?> returnType,\n\t\t\tSqlAstTranslator<?> walker) {\n\t\t// jsonb_path_query functions error by default\n\t\tif ( arguments.errorBehavior() != null && arguments.errorBehavior() != JsonQueryErrorBehavior.ERROR ) {\n\t\t\tthrow new QueryException( \"Can't emulate on error clause on CockroachDB\" );\n\t\t}\n\t\tif ( arguments.emptyBehavior() != null && arguments.emptyBehavior() != JsonQueryEmptyBehavior.NULL ) {\n\t\t\tthrow new QueryException( \"Can't emulate on empty clause on CockroachDB\" );\n\t\t}\n\t\tfinal JsonQueryWrapMode wrapMode = arguments.wrapMode();\n\n\t\tif ( wrapMode == JsonQueryWrapMode.WITH_WRAPPER ) {\n\t\t\tsqlAppender.appendSql( \"jsonb_build_array(\" );\n\t\t}\n\t\tfinal Expression jsonDocumentExpression = arguments.jsonDocument();\n\t\tfinal String jsonPath;\n\t\ttry {\n\t\t\tjsonPath = walker.getLiteralValue( arguments.jsonPath() );\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tthrow new QueryException( \"CockroachDB json_value only support literal json paths, but got \" + arguments.jsonPath() );\n\t\t}\n\t\tappendJsonQuery(\n\t\t\t\tsqlAppender,\n\t\t\t\tjsonDocumentExpression,\n\t\t\t\tJsonPathHelper.parseJsonPathElements( jsonPath ),","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonQueryFunction.java#L25-L61","documentation":"Error \"Can't emulate on empty 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 empty 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 empty clause on CockroachDB.","solutions":["Remove the ON EMPTY 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"}