{"record":{"id":"944f6c81187d1b34","repo":"hibernate/hibernate-orm","slug":"xml-array-columnexpression-in-aggr","errorCode":null,"errorMessage":"\"XML array '\" + columnExpression + \"' in '\" + aggregateParentReadExpression + \"' is not supported with legacy format enabled.\"","messagePattern":"\"XML array '\" \\+ columnExpression \\+ \"' in '\" \\+ aggregateParentReadExpression \\+ \"' 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/DB2AggregateSupport.java","lineNumber":185,"sourceCode":"\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\"hextoraw(xmlcast(xmlquery(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + \") as clob))\"\n\t\t\t\t\t\t);\n\t\t\t\t\tcase TIMESTAMP_WITH_TIMEZONE:\n\t\t\t\t\tcase TIMESTAMP_UTC:\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(replace(trim(trailing 'Z' from xmlcast(xmlquery(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + \") as varchar(35))),'T',' ') as \" + getCastTypeName( column, typeConfiguration ) + \")\"\n\t\t\t\t\t\t);\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 + \"/*\" ) + \"))\"\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\\\",xmlquery(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression + \"/*\" ) + \"))\"\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\tcase UUID:\n\t\t\t\t\t\tif ( SqlTypes.isBinaryType( column.getJdbcMapping().getJdbcType().getDdlTypeCode() ) ) {\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\"hextoraw(replace(xmlcast(xmlquery(\" + xmlExtractArguments( aggregateParentReadExpression, columnExpression ) + \") as varchar(36)),'-',''))\"\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Fall-through intended\n\t\t\t\t\tdefault:\n\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\tplaceholder,","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/DB2AggregateSupport.java#L167-L203","documentation":"Error \"\"XML array '\" + columnExpression + \"' in '\" + aggregateParentReadExpression + \"' 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 (DB2).","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 (DB2).","solutions":["Disable legacy XML format.","Avoid XML array aggregates on DB2."],"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"}