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/SpannerPostgreSQLAggregateSupport.java:33
import static org.hibernate.type.SqlTypes.JSON;
import static org.hibernate.type.SqlTypes.JSON_ARRAY;
/***
* Spanner supports only JSON aggregation. It doesn't support XML or STRUCT aggregation
*/
public class SpannerPostgreSQLAggregateSupport extends PostgreSQLAggregateSupport {
public static final AggregateSupport INSTANCE = new SpannerPostgreSQLAggregateSupport();
@Override
public String aggregateComponentCustomReadExpression(String template, String placeholder, String aggregateParentReadExpression, String columnExpression, int aggregateColumnTypeCode, SqlTypedMapping column, TypeConfiguration typeConfiguration) {
return switch ( aggregateColumnTypeCode ) {
case JSON_ARRAY, JSON ->
super.aggregateComponentCustomReadExpression( template, placeholder, aggregateParentReadExpression,
columnExpression, aggregateColumnTypeCode, column, typeConfiguration );
default ->
throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateColumnTypeCode );
};
}
@Override
public String aggregateComponentAssignmentExpression(String aggregateParentAssignmentExpression, String columnExpression, int aggregateColumnTypeCode, Column column) {
return switch ( aggregateColumnTypeCode ) {
case JSON, JSON_ARRAY ->
super.aggregateComponentAssignmentExpression( aggregateParentAssignmentExpression, columnExpression,
aggregateColumnTypeCode, column );
default ->
throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateColumnTypeCode );
};
}
@Override
public boolean requiresAggregateCustomWriteExpressionRenderer(int aggregateSqlTypeCode) {
return aggregateSqlTypeCode == JSON;
}View on GitHub (pinned to fad1729dce)
Solutions
- Map the aggregate column with a supported SQL type.
- Avoid the unsupported aggregate type on Spanner.
When it happens
Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported aggregate SQL type (Spanner PostgreSQL).
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 (Spanner PostgreSQL).
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/2f4b7e8b214c85dd.
Report an issue: GitHub.