{"record":{"id":"cc815f8d2a9da276","repo":"hibernate/hibernate-orm","slug":"can-t-emulate-json-exists-true-on-error-on-sq","errorCode":null,"errorMessage":"Can't emulate json_exists(... true on error) on SQL Server","messagePattern":"Can't emulate json_exists\\(\\.\\.\\. true on error\\) on SQL Server","errorType":"exception","errorClass":"QueryException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/function/json/SQLServerJsonExistsFunction.java","lineNumber":37,"sourceCode":" * SQL Server json_exists function.\n */\npublic class SQLServerJsonExistsFunction extends JsonExistsFunction {\n\n\tprivate final boolean supportsExtendedJson;\n\n\tpublic SQLServerJsonExistsFunction(boolean supportsExtendedJson, TypeConfiguration typeConfiguration) {\n\t\tsuper( typeConfiguration, true, false );\n\t\tthis.supportsExtendedJson = supportsExtendedJson;\n\t}\n\n\t@Override\n\tprotected void render(\n\t\t\tSqlAppender sqlAppender,\n\t\t\tJsonExistsArguments arguments,\n\t\t\tReturnableType<?> returnType,\n\t\t\tSqlAstTranslator<?> walker) {\n\t\tif ( arguments.errorBehavior() == JsonExistsErrorBehavior.TRUE ) {\n\t\t\tthrow new QueryException( \"Can't emulate json_exists(... true on error) on SQL Server\" );\n\t\t}\n\t\tif ( supportsExtendedJson ) {\n\t\t\tif ( arguments.errorBehavior() == JsonExistsErrorBehavior.ERROR ) {\n\t\t\t\tsqlAppender.append( '(' );\n\t\t\t}\n\t\t\tsqlAppender.appendSql( \"json_path_exists(\" );\n\t\t\targuments.jsonDocument().accept( walker );\n\t\t\tsqlAppender.appendSql( ',' );\n\t\t\tfinal JsonPathPassingClause passingClause = arguments.passingClause();\n\t\t\tif ( passingClause != null ) {\n\t\t\t\tJsonPathHelper.appendInlinedJsonPathIncludingPassingClause(\n\t\t\t\t\t\tsqlAppender,\n\t\t\t\t\t\t\"\",\n\t\t\t\t\t\targuments.jsonPath(),\n\t\t\t\t\t\tpassingClause,\n\t\t\t\t\t\twalker\n\t\t\t\t);\n\t\t\t}","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/function/json/SQLServerJsonExistsFunction.java#L19-L55","documentation":"Error \"Can't emulate json_exists(... true on error) on SQL Server\" 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 json_exists(... true on error) on SQL Server.","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 json_exists(... true on error) on SQL Server.","solutions":["Remove the TRUE ON ERROR clause for SQL Server."],"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"}