hibernate/hibernate-orm · error · IllegalArgumentException
XML array '{}' in '{}' is not supported with legacy format e
Error message
XML array '{}' in '{}' is not supported with legacy format enabled. What it means
Error "XML array '{}' in '{}' is not supported with legacy format enabled." thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/PostgreSQLAggregateSupport.java:136
);
}
default:
return template.replace(
placeholder,
"cast(" + aggregateParentReadExpression + "->>'" + columnExpression + "' as " + getCastTypeName( column, typeConfiguration ) + ')'
);
}
case XML_ARRAY:
case SQLXML:
switch ( column.getJdbcMapping().getJdbcType().getDefaultSqlTypeCode() ) {
case SQLXML:
return template.replace(
placeholder,
XML_EXTRACT_START + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/*" ) + XML_EXTRACT_END
);
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\",(select xmlagg(t.v order by t.i) from xmltable(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + "/*" ) + " columns v xml path '.', i for ordinality)t))"
);
}
case BINARY:
case VARBINARY:
case LONG32VARBINARY:
// We encode binary data as hex, so we have to decode here
return template.replace(
placeholder,
"decode((select t.v from xmltable(" + xmlExtractArguments( aggregateParentReadExpression, columnExpression )+ " columns v text path '.') t),'hex')"
);
case ARRAY:
throw new UnsupportedOperationException( "Transforming XML_ARRAY to native arrays is not supported on PostgreSQL!" );
default:View on GitHub (pinned to fad1729dce)
Solutions
- Disable legacy XML format.
- Avoid XML array aggregates on PostgreSQL.
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 (PostgreSQL).
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 (PostgreSQL).
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/9c972ec886fbd1d3.
Report an issue: GitHub.