hibernate/hibernate-orm · error · UnsupportedOperationException

The Oracle version doesn't support JSON aggregates!

Error message

The Oracle version doesn't support JSON aggregates!

What it means

OracleAggregateSupport requires JSON aggregate support (Oracle 21+ with JSON type support) to build json_value/json_query read expressions; the connected Oracle version lacks JSON aggregate capability, so aggregate component read expression generation aborts.

Solutions

  1. Upgrade Oracle to a version with JSON support.
  2. Avoid JSON aggregates on this Oracle version.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: The Oracle version doesn't support JSON aggregates!.

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: The Oracle version doesn't support JSON aggregates!.


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

Appendix: source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/OracleAggregateSupport.java:273

												placeholder,
												"json_value(" + parentPartExpression + columnExpression + "' returning " + getTypeName( column, typeConfiguration ) + ')'
										);
								}
							case JSON:
							case JSON_ARRAY:
								return template.replace(
										placeholder,
										"json_query(" + parentPartExpression + columnExpression + "' returning " + jsonTypeName + ")"
								);
							default:
								return template.replace(
										placeholder,
										"cast(json_value(" + parentPartExpression + columnExpression + "') as " + getNarrowCastTypeName( column, typeConfiguration ) + ')'
								);

						}
					case NONE:
						throw new UnsupportedOperationException( "The Oracle version doesn't support JSON aggregates!" );
				}
			case SQLXML:
			case XML_ARRAY:
				switch ( column.getJdbcMapping().getJdbcType().getDefaultSqlTypeCode() ) {
					case BIT:
					case BOOLEAN:
						//noinspection unchecked
						final JdbcLiteralFormatter<Boolean> jdbcLiteralFormatter = (JdbcLiteralFormatter<Boolean>) column.getJdbcMapping().getJdbcType()
								.getJdbcLiteralFormatter( column.getJdbcMapping().getMappedJavaType() );
						final Dialect dialect = typeConfiguration.getCurrentBaseSqlTypeIndicators().getDialect();
						final WrapperOptions wrapperOptions = getWrapperOptions( typeConfiguration );
						final String trueLiteral = jdbcLiteralFormatter.toJdbcLiteral( true, dialect, wrapperOptions );
						final String falseLiteral = jdbcLiteralFormatter.toJdbcLiteral( false, dialect, wrapperOptions );
						return template.replace(
								placeholder,
								"decode(xmlcast(xmlquery(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/text()" ) + ") as varchar(5)),'true'," + trueLiteral + ",'false'," + falseLiteral + ",null)"
						);
					case FLOAT:

View on GitHub (pinned to fad1729dce)