{"record":{"id":"2f4b7e8b214c85dd","repo":"hibernate/hibernate-orm","slug":"unsupported-aggregate-sql-type-2f4b7e","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/SpannerPostgreSQLAggregateSupport.java","lineNumber":33,"sourceCode":"\nimport static org.hibernate.type.SqlTypes.JSON;\nimport static org.hibernate.type.SqlTypes.JSON_ARRAY;\n\n/***\n * Spanner supports only JSON aggregation. It doesn't support XML or STRUCT aggregation\n */\npublic class SpannerPostgreSQLAggregateSupport extends PostgreSQLAggregateSupport {\n\n\tpublic static final AggregateSupport INSTANCE = new SpannerPostgreSQLAggregateSupport();\n\n\t@Override\n\tpublic String aggregateComponentCustomReadExpression(String template, String placeholder, String aggregateParentReadExpression, String columnExpression, int aggregateColumnTypeCode, SqlTypedMapping column, TypeConfiguration typeConfiguration) {\n\t\treturn switch ( aggregateColumnTypeCode ) {\n\t\t\tcase JSON_ARRAY, JSON ->\n\t\t\t\t\tsuper.aggregateComponentCustomReadExpression( template, placeholder, aggregateParentReadExpression,\n\t\t\t\t\t\t\tcolumnExpression, aggregateColumnTypeCode, column, typeConfiguration );\n\t\t\tdefault ->\n\t\t\t\t\tthrow new IllegalArgumentException( \"Unsupported aggregate SQL type: \" + aggregateColumnTypeCode );\n\t\t};\n\t}\n\n\t@Override\n\tpublic String aggregateComponentAssignmentExpression(String aggregateParentAssignmentExpression, String columnExpression, int aggregateColumnTypeCode, Column column) {\n\t\treturn switch ( aggregateColumnTypeCode ) {\n\t\t\tcase JSON, JSON_ARRAY ->\n\t\t\t\t\tsuper.aggregateComponentAssignmentExpression( aggregateParentAssignmentExpression, columnExpression,\n\t\t\t\t\t\t\taggregateColumnTypeCode, column );\n\t\t\tdefault ->\n\t\t\t\t\tthrow new IllegalArgumentException( \"Unsupported aggregate SQL type: \" + aggregateColumnTypeCode );\n\t\t};\n\t}\n\n\t@Override\n\tpublic boolean requiresAggregateCustomWriteExpressionRenderer(int aggregateSqlTypeCode) {\n\t\treturn aggregateSqlTypeCode == JSON;\n\t}","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/SpannerPostgreSQLAggregateSupport.java#L15-L51","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 (Spanner PostgreSQL).","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 (Spanner PostgreSQL).","solutions":["Map the aggregate column with a supported SQL type.","Avoid the unsupported aggregate type on Spanner."],"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"}