hibernate/hibernate-orm · error · IllegalArgumentException
Unsupported aggregate SQL type: {}
Error message
Unsupported aggregate SQL type: {} What it means
Error "Unsupported aggregate SQL type: {}" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/SQLServerAggregateSupport.java:201
"cast('<Collection>'+cast(" + xmlColumn + XML_QUERY_SEPARATOR + parentXmlPartExpression + "/" + columnExpression + "/*') as nvarchar(max))+'</Collection>' as xml)"
);
case BINARY:
case VARBINARY:
case LONG32VARBINARY:
case BLOB:
// We encode binary data as hex, so we have to decode here
return template.replace(
placeholder,
"convert(" + getCastTypeName( column, typeConfiguration ) + "," + xmlColumn + ".value('(" + parentXmlPartExpression + "/" + columnExpression + "/text())[1]','nvarchar(max)'),2)"
);
default:
return template.replace(
placeholder,
xmlColumn + ".value('(" + parentXmlPartExpression + "/" + columnExpression + "/text())[1]','" + getCastTypeName( column, typeConfiguration ) + "')"
);
}
}
throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateColumnTypeCode );
}
@Override
public String aggregateComponentAssignmentExpression(
String aggregateParentAssignmentExpression,
String columnExpression,
int aggregateColumnTypeCode,
Column column) {
switch ( aggregateColumnTypeCode ) {
case JSON:
case JSON_ARRAY:
if ( jsonSupportLevel == JsonSupportLevel.NONE ) {
break;
}
case SQLXML:
case XML_ARRAY:
// For JSON/XML we always have to replace the whole object
return aggregateParentAssignmentExpression;View on GitHub (pinned to fad1729dce)
Solutions
- Map the aggregate column with a supported SQL type (JSON).
- Avoid the unsupported aggregate type on SQL Server.
When it happens
Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported aggregate SQL type (SQL Server).
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: Unsupported aggregate SQL type (SQL Server).
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/473aaf1998492330.
Report an issue: GitHub.