{"record":{"id":"6f8240e55b5da111","repo":"hibernate/hibernate-orm","slug":"unsupported-aggregate-sql-type-aggregatecolu-6f8240","errorCode":null,"errorMessage":"\"Unsupported aggregate SQL type: \" + aggregateColumnTypeCode","messagePattern":"\"Unsupported aggregate SQL type: \" \\+ aggregateColumnTypeCode","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/dialect/aggregate/H2AggregateSupport.java","lineNumber":104,"sourceCode":"\t\t\t\t\t\t\t\t// We encode binary data as hex, so we have to decode here\n\t\t\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\t\t\"(select array_agg(\" + hexDecodeExpression( queryExpression( readExpression + \"[i.x]\" ), elementTypeName ) + \") from system_range(1,10000) i where i.x<=coalesce(array_length(\" + readExpression + \"),0))\"\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\treturn template.replace(\n\t\t\t\t\t\t\t\t\t\tplaceholder,\n\t\t\t\t\t\t\t\t\t\t\"(select array_agg(\" + valueExpression( readExpression + \"[i.x]\", elementTypeName ) + \") from system_range(1,10000) i where i.x<=coalesce(array_length(\" + readExpression + \"),0))\"\n\t\t\t\t\t\t\t\t);\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\tvalueExpression( readExpression, 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\tprivate static String hexDecodeExpression(String valueExpression, String columnType) {\n\t\treturn \"cast(hextoraw(regexp_replace(\" + valueExpression + \",'([0-9a-f][0-9a-f])','00$1')) as \" + columnType + \")\";\n\t}\n\n\tprivate static String valueExpression(String valueExpression, String columnType) {\n\t\treturn \"cast(\" + queryExpression( valueExpression ) + \" as \" + columnType + ')';\n\t}\n\n\tprivate static String queryExpression(String valueExpression) {\n\t\t// First we produce a SQL null if we see a JSON null\n\t\t// Next, we replace quotes that surround the value\n\t\t// Finally, we undo escaping that was done to a string\n\t\treturn \"stringdecode(regexp_replace(nullif(\" + valueExpression + \",JSON'null'),'^\\\"(.*)\\\"$','$1'))\";\n\t}\n\n\tprivate static String jsonCustomWriteExpression(String customWriteExpression, JdbcMapping jdbcMapping) {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/H2AggregateSupport.java#L86-L122","documentation":"Error \"\"Unsupported aggregate SQL type: \" + aggregateColumnTypeCode\" 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 (H2).","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 (H2).","solutions":["Map the aggregate column with a supported SQL type (JSON/ARRAY).","Avoid the unsupported aggregate type on H2."],"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"}