{"record":{"id":"473aaf1998492330","repo":"hibernate/hibernate-orm","slug":"unsupported-aggregate-sql-type-473aaf","errorCode":null,"errorMessage":"Unsupported aggregate SQL type: {}","messagePattern":"Unsupported aggregate SQL type: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/aggregate/SQLServerAggregateSupport.java","lineNumber":201,"sourceCode":"\t\t\t\t\t\t\t\t\"cast('<Collection>'+cast(\" + xmlColumn + XML_QUERY_SEPARATOR + parentXmlPartExpression + \"/\" + columnExpression + \"/*') as nvarchar(max))+'</Collection>' as xml)\"\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\tcase BLOB:\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\"convert(\" + getCastTypeName( column, typeConfiguration ) + \",\" + xmlColumn + \".value('(\" + parentXmlPartExpression + \"/\" + columnExpression + \"/text())[1]','nvarchar(max)'),2)\"\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\txmlColumn + \".value('(\" + parentXmlPartExpression + \"/\" + columnExpression + \"/text())[1]','\" + getCastTypeName( column, typeConfiguration ) + \"')\"\n\t\t\t\t\t\t);\n\t\t\t\t}\n\t\t}\n\t\tthrow new IllegalArgumentException( \"Unsupported aggregate SQL type: \" + aggregateColumnTypeCode );\n\t}\n\n\t@Override\n\tpublic String aggregateComponentAssignmentExpression(\n\t\t\tString aggregateParentAssignmentExpression,\n\t\t\tString columnExpression,\n\t\t\tint aggregateColumnTypeCode,\n\t\t\tColumn column) {\n\t\tswitch ( aggregateColumnTypeCode ) {\n\t\t\tcase JSON:\n\t\t\tcase JSON_ARRAY:\n\t\t\t\tif ( jsonSupportLevel == JsonSupportLevel.NONE ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\tcase SQLXML:\n\t\t\tcase XML_ARRAY:\n\t\t\t\t// For JSON/XML we always have to replace the whole object\n\t\t\t\treturn aggregateParentAssignmentExpression;","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/SQLServerAggregateSupport.java#L183-L219","documentation":"Error \"Unsupported aggregate SQL type: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported aggregate SQL type (SQL Server).","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: Unsupported aggregate SQL type (SQL Server).","solutions":["Map the aggregate column with a supported SQL type (JSON).","Avoid the unsupported aggregate type on SQL Server."],"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"}