hibernate/hibernate-orm · error · QueryException

Can't emulate null on error clause on CockroachDB

Error message

Can't emulate null on error clause on CockroachDB

What it means

Error "Can't emulate null on error clause on CockroachDB" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonTableFunction.java:47

/**
 * CockroachDB json_table function.
 */
public class CockroachDBJsonTableFunction extends PostgreSQLJsonTableFunction {

	public CockroachDBJsonTableFunction(TypeConfiguration typeConfiguration) {
		super( typeConfiguration );
	}

	@Override
	protected void renderJsonTable(
			SqlAppender sqlAppender,
			JsonTableArguments arguments,
			AnonymousTupleTableGroupProducer tupleType,
			String tableIdentifierVariable,
			SqlAstTranslator<?> walker) {
		if ( arguments.errorBehavior() == JsonTableErrorBehavior.NULL ) {
			throw new QueryException( "Can't emulate null on error clause on CockroachDB" );
		}
		final SqlAstNode jsonPathExpression = arguments.jsonPath();
		final List<JsonPathHelper.JsonPathElement> jsonPathElements;
		final boolean isArray;
		if ( jsonPathExpression == null ) {
			jsonPathElements = Collections.emptyList();
			// Assume array by default
			isArray = true;
		}
		else {
			final String jsonPath;
			try {
				jsonPath = walker.getLiteralValue( arguments.jsonPath() );
			}
			catch (Exception ex) {
				throw new QueryException( "CockroachDB json_table only support literal json paths, but got " + arguments.jsonPath() );
			}
			isArray = jsonPath.endsWith( "[*]" );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Remove the NULL 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 null 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 null on error clause on CockroachDB.


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/e582840cc868043f. Report an issue: GitHub.