hibernate/hibernate-orm · error · IllegalArgumentException
"Unsupported aggregate SQL type: " + aggregateColumnTypeCode
Error message
"Unsupported aggregate SQL type: " + aggregateColumnTypeCode
What it means
Error ""Unsupported aggregate SQL type: " + aggregateColumnTypeCode" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/H2AggregateSupport.java:104
// We encode binary data as hex, so we have to decode here
return template.replace(
placeholder,
"(select array_agg(" + hexDecodeExpression( queryExpression( readExpression + "[i.x]" ), elementTypeName ) + ") from system_range(1,10000) i where i.x<=coalesce(array_length(" + readExpression + "),0))"
);
default:
return template.replace(
placeholder,
"(select array_agg(" + valueExpression( readExpression + "[i.x]", elementTypeName ) + ") from system_range(1,10000) i where i.x<=coalesce(array_length(" + readExpression + "),0))"
);
}
default:
return template.replace(
placeholder,
valueExpression( readExpression, getCastTypeName( column, typeConfiguration ) )
);
}
}
throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateColumnTypeCode );
}
private static String hexDecodeExpression(String valueExpression, String columnType) {
return "cast(hextoraw(regexp_replace(" + valueExpression + ",'([0-9a-f][0-9a-f])','00$1')) as " + columnType + ")";
}
private static String valueExpression(String valueExpression, String columnType) {
return "cast(" + queryExpression( valueExpression ) + " as " + columnType + ')';
}
private static String queryExpression(String valueExpression) {
// First we produce a SQL null if we see a JSON null
// Next, we replace quotes that surround the value
// Finally, we undo escaping that was done to a string
return "stringdecode(regexp_replace(nullif(" + valueExpression + ",JSON'null'),'^\"(.*)\"$','$1'))";
}
private static String jsonCustomWriteExpression(String customWriteExpression, JdbcMapping jdbcMapping) {View on GitHub (pinned to fad1729dce)
Solutions
- Map the aggregate column with a supported SQL type (JSON/ARRAY).
- Avoid the unsupported aggregate type on H2.
When it happens
Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported aggregate SQL type (H2).
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 (H2).
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/6f8240e55b5da111.
Report an issue: GitHub.