{"record":{"id":"f4904cac078ff7d9","repo":"hibernate/hibernate-orm","slug":"unsupported-aggregate-sql-type-aggregatecolu","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/CockroachDBAggregateSupport.java","lineNumber":111,"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\"array(select decode(jsonb_array_elements_text(\" + aggregateParentReadExpression + \"->'\" + columnExpression + \"'),'hex'))\"\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\"cast(array(select jsonb_array_elements_text(\" + aggregateParentReadExpression + \"->'\" + columnExpression + \"')) as \" + getCastTypeName( column, typeConfiguration ) + ')'\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\t\"cast(\" + aggregateParentReadExpression + \"->>'\" + columnExpression + \"' as \" + 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 jsonCustomWriteExpression(String customWriteExpression, JdbcMapping jdbcMapping) {\n\t\tfinal int sqlTypeCode = jdbcMapping.getJdbcType().getDefaultSqlTypeCode();\n\t\tswitch ( sqlTypeCode ) {\n\t\t\tcase BINARY:\n\t\t\tcase VARBINARY:\n\t\t\tcase LONG32VARBINARY:\n\t\t\t\t// We encode binary data as hex\n\t\t\t\treturn \"to_jsonb(encode(\" + customWriteExpression + \",'hex'))\";\n\t\t\tcase ARRAY:\n\t\t\t\tfinal BasicPluralType<?, ?> pluralType = (BasicPluralType<?, ?>) jdbcMapping;\n\t\t\t\tswitch ( pluralType.getElementType().getJdbcType().getDefaultSqlTypeCode() ) {\n\t\t\t\t\tcase BINARY:\n\t\t\t\t\tcase VARBINARY:\n\t\t\t\t\tcase LONG32VARBINARY:\n\t\t\t\t\t\t// We encode binary data as hex\n\t\t\t\t\t\treturn \"to_jsonb(array(select encode(unnest(\" + customWriteExpression + \"),'hex')))\";","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/CockroachDBAggregateSupport.java#L93-L129","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 (CockroachDB).","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 (CockroachDB).","solutions":["Map the aggregate column with a supported SQL type (JSON/ARRAY).","Avoid the unsupported aggregate type on CockroachDB."],"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"}