hibernate/hibernate-orm · error · IllegalArgumentException
"XML array '" + columnExpression + "' in '" +…
Error message
"XML array '" + columnExpression + "' in '" + aggregateParentReadExpression + "' is not supported with legacy format enabled."
What it means
DB2AggregateSupport refuses to extract an XML array component when the legacy-format XML mapper setting is enabled: the legacy XML document layout lacks the structure these xmlquery expressions target. The at-fault configuration is hibernate.type.xml_format_mapper.legacy_format=true combined with an XML aggregate array column.
Solutions
- Disable legacy XML format.
- Avoid XML array aggregates on DB2.
Defensive patterns
Strategy: validation
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.
Appendix: 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)