hibernate/hibernate-orm · error · IllegalArgumentException

"XML array '" + columnExpression + "' in '" + aggregateParen

Error message

"XML array '" + columnExpression + "' in '" + aggregateParentReadExpression + "' is not supported with legacy format enabled."

What it means

Error ""XML array '" + columnExpression + "' in '" + aggregateParentReadExpression + "' is not supported with legacy format enabled."" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/DB2AggregateSupport.java:185

						// We encode binary data as hex, so we have to decode here
						return template.replace(
								placeholder,
								"hextoraw(xmlcast(xmlquery(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + ") as clob))"
						);
					case TIMESTAMP_WITH_TIMEZONE:
					case TIMESTAMP_UTC:
						return template.replace(
								placeholder,
								"cast(replace(trim(trailing 'Z' from xmlcast(xmlquery(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + ") as varchar(35))),'T',' ') as " + getCastTypeName( column, typeConfiguration ) + ")"
						);
					case SQLXML:
						return template.replace(
								placeholder,
								XML_EXTRACT_START + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/*" ) + "))"
						);
					case XML_ARRAY:
						if ( typeConfiguration.getCurrentBaseSqlTypeIndicators().isXmlFormatMapperLegacyFormatEnabled() ) {
							throw new IllegalArgumentException( "XML array '" + columnExpression + "' in '" + aggregateParentReadExpression + "' is not supported with legacy format enabled." );
						}
						else {
							return template.replace(
									placeholder,
									"xmlelement(name \"Collection\",xmlquery(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/*" ) + "))"
							);
						}
					case UUID:
						if ( SqlTypes.isBinaryType( column.getJdbcMapping().getJdbcType().getDdlTypeCode() ) ) {
							return template.replace(
									placeholder,
									"hextoraw(replace(xmlcast(xmlquery(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + ") as varchar(36)),'-',''))"
							);
						}
						// Fall-through intended
					default:
						return template.replace(
								placeholder,

View on GitHub (pinned to fad1729dce)

Solutions

  1. Disable legacy XML format.
  2. Avoid XML array aggregates on DB2.

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: XML array is not supported with legacy format enabled (DB2).

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: XML array is not supported with legacy format enabled (DB2).


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