{"record":{"id":"9c972ec886fbd1d3","repo":"hibernate/hibernate-orm","slug":"xml-array-in-is-not-supported-with-legac-9c972e","errorCode":null,"errorMessage":"XML array '{}' in '{}' is not supported with legacy format enabled.","messagePattern":"XML array '(.+?)' in '(.+?)' is not supported with legacy format enabled\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/aggregate/PostgreSQLAggregateSupport.java","lineNumber":136,"sourceCode":"\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\"cast(\" + aggregateParentReadExpression + \"->>'\" + columnExpression + \"' as \" + getCastTypeName( column, typeConfiguration ) + ')'\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t\tcase XML_ARRAY:\n\t\t\tcase SQLXML:\n\t\t\t\tswitch ( column.getJdbcMapping().getJdbcType().getDefaultSqlTypeCode() ) {\n\t\t\t\t\tcase SQLXML:\n\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\tXML_EXTRACT_START + xmlExtractArguments( aggregateParentReadExpression, columnExpression + \"/*\" ) + XML_EXTRACT_END\n\t\t\t\t\t\t);\n\t\t\t\t\tcase XML_ARRAY:\n\t\t\t\t\t\tif ( typeConfiguration.getCurrentBaseSqlTypeIndicators().isXmlFormatMapperLegacyFormatEnabled() ) {\n\t\t\t\t\t\t\tthrow new IllegalArgumentException( \"XML array '\" + columnExpression + \"' in '\" + aggregateParentReadExpression + \"' is not supported with legacy format enabled.\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\t\"xmlelement(name \\\"Collection\\\",(select xmlagg(t.v order by t.i) from xmltable(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + \"/*\" ) + \" columns v xml path '.', i for ordinality)t))\"\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\tcase BINARY:\n\t\t\t\t\tcase VARBINARY:\n\t\t\t\t\tcase LONG32VARBINARY:\n\t\t\t\t\t\t// We encode binary data as hex, so we have to decode here\n\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\"decode((select t.v from xmltable(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression )+ \" columns v text path '.') t),'hex')\"\n\t\t\t\t\t\t);\n\t\t\t\t\tcase ARRAY:\n\t\t\t\t\t\tthrow new UnsupportedOperationException( \"Transforming XML_ARRAY to native arrays is not supported on PostgreSQL!\" );\n\t\t\t\t\tdefault:","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/PostgreSQLAggregateSupport.java#L118-L154","documentation":"Error \"XML array '{}' in '{}' is not supported with legacy format enabled.\" thrown in hibernate/hibernate-orm.","triggerScenarios":"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).","commonSituations":"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).","solutions":["Disable legacy XML format.","Avoid XML array aggregates on PostgreSQL."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}