hibernate/hibernate-orm · error · QueryException
Can't emulate json_exists(... true on error) on SQL Server
Error message
Can't emulate json_exists(... true on error) on SQL Server
What it means
Error "Can't emulate json_exists(... true on error) on SQL Server" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/json/SQLServerJsonExistsFunction.java:37
* SQL Server json_exists function.
*/
public class SQLServerJsonExistsFunction extends JsonExistsFunction {
private final boolean supportsExtendedJson;
public SQLServerJsonExistsFunction(boolean supportsExtendedJson, TypeConfiguration typeConfiguration) {
super( typeConfiguration, true, false );
this.supportsExtendedJson = supportsExtendedJson;
}
@Override
protected void render(
SqlAppender sqlAppender,
JsonExistsArguments arguments,
ReturnableType<?> returnType,
SqlAstTranslator<?> walker) {
if ( arguments.errorBehavior() == JsonExistsErrorBehavior.TRUE ) {
throw new QueryException( "Can't emulate json_exists(... true on error) on SQL Server" );
}
if ( supportsExtendedJson ) {
if ( arguments.errorBehavior() == JsonExistsErrorBehavior.ERROR ) {
sqlAppender.append( '(' );
}
sqlAppender.appendSql( "json_path_exists(" );
arguments.jsonDocument().accept( walker );
sqlAppender.appendSql( ',' );
final JsonPathPassingClause passingClause = arguments.passingClause();
if ( passingClause != null ) {
JsonPathHelper.appendInlinedJsonPathIncludingPassingClause(
sqlAppender,
"",
arguments.jsonPath(),
passingClause,
walker
);
}View on GitHub (pinned to fad1729dce)
Solutions
- Remove the TRUE ON ERROR clause for SQL Server.
When it happens
Trigger: 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.
Common situations: 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.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/cc815f8d2a9da276.
Report an issue: GitHub.