hibernate/hibernate-orm · error · QueryException

CockroachDB json_value only support literal json paths, but

Error message

CockroachDB json_value only support literal json paths, but got " + arguments.jsonPath()

What it means

Error "CockroachDB json_value only support literal json paths, but got " + arguments.jsonPath()" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/function/json/CockroachDBJsonExistsFunction.java:45

		super( typeConfiguration, true, true );
	}

	@Override
	protected void render(
			SqlAppender sqlAppender,
			JsonExistsArguments arguments,
			ReturnableType<?> returnType,
			SqlAstTranslator<?> walker) {
		// jsonb_path_exists errors by default
		if ( arguments.errorBehavior() != null && arguments.errorBehavior() != JsonExistsErrorBehavior.ERROR ) {
			throw new QueryException( "Can't emulate on error clause on CockroachDB" );
		}
		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() );
		}
		appendJsonExists(
				sqlAppender,
				arguments.jsonDocument(),
				JsonPathHelper.parseJsonPathElements( jsonPath ),
				arguments.isJsonType(),
				arguments.passingClause(),
				walker
		);
	}

	static void appendJsonExists(
			SqlAppender sqlAppender,
			Expression jsonDocument,
			List<JsonPathHelper.JsonPathElement> jsonPathElements,
			boolean isJsonType,
			@Nullable JsonPathPassingClause jsonPathPassingClause,
			SqlAstTranslator<?> walker) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Pass the JSON path as a string literal.
  2. Inline the path instead of using a parameter.

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: CockroachDB json_value only support literal json paths.

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: CockroachDB json_value only support literal json paths.


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