hibernate/hibernate-orm · error · QueryException
Can't emulate on error clause on CockroachDB
Error message
Can't emulate on error clause on CockroachDB
What it means
Error "Can't emulate on error clause on CockroachDB" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonQueryFunction.java:40
/**
* CockroachDB json_query function.
*/
public class CockroachDBJsonQueryFunction extends JsonQueryFunction {
public CockroachDBJsonQueryFunction(TypeConfiguration typeConfiguration) {
super( typeConfiguration, true, true );
}
@Override
protected void render(
SqlAppender sqlAppender,
JsonQueryArguments arguments,
ReturnableType<?> returnType,
SqlAstTranslator<?> walker) {
// jsonb_path_query functions error by default
if ( arguments.errorBehavior() != null && arguments.errorBehavior() != JsonQueryErrorBehavior.ERROR ) {
throw new QueryException( "Can't emulate on error clause on CockroachDB" );
}
if ( arguments.emptyBehavior() != null && arguments.emptyBehavior() != JsonQueryEmptyBehavior.NULL ) {
throw new QueryException( "Can't emulate on empty clause on CockroachDB" );
}
final JsonQueryWrapMode wrapMode = arguments.wrapMode();
if ( wrapMode == JsonQueryWrapMode.WITH_WRAPPER ) {
sqlAppender.appendSql( "jsonb_build_array(" );
}
final Expression jsonDocumentExpression = arguments.jsonDocument();
final String jsonPath;
try {
jsonPath = walker.getLiteralValue( arguments.jsonPath() );
}
catch (Exception ex) {
throw new QueryException( "CockroachDB json_value only support literal json paths, but got " + arguments.jsonPath() );
}
appendJsonQuery(View on GitHub (pinned to fad1729dce)
Solutions
- Remove the ON ERROR clause for CockroachDB.
When it happens
Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Can't emulate on error clause on CockroachDB.
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 on error clause on CockroachDB.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/247c1d0e422247a1.
Report an issue: GitHub.