{"record":{"id":"fef99eb177421e71","repo":"hibernate/hibernate-orm","slug":"unsupported-aggregate-sql-type-fef99e","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/MySQLAggregateSupport.java","lineNumber":140,"sourceCode":"\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\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\"unhex(replace(json_unquote(\" + queryExpression( aggregateParentReadExpression,\n\t\t\t\t\t\t\t\t\t\t\t\tcolumnExpression ) + \"),'-',''))\"\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Fall-through intended\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( aggregateParentReadExpression, columnExpression, columnCastType( 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 String columnCastType(SqlTypedMapping column, TypeConfiguration typeConfiguration) {\n\t\treturn switch (column.getJdbcMapping().getJdbcType().getDdlTypeCode()) {\n\t\t\t// special case for casting to Boolean\n\t\t\tcase BOOLEAN, BIT -> \"unsigned\";\n\t\t\t// MySQL doesn't let you cast to INTEGER/BIGINT/TINYINT\n\t\t\tcase TINYINT, SMALLINT, INTEGER, BIGINT -> \"signed\";\n\t\t\tcase REAL -> \"float\";\n\t\t\tcase DOUBLE -> \"double\";\n\t\t\tcase FLOAT -> jsonType\n\t\t\t\t\t// In newer versions of MySQL, casting to float/double is supported\n\t\t\t\t\t? getCastTypeName( column, typeConfiguration )\n\t\t\t\t\t: column.getPrecision() == null || column.getPrecision() == 53 ? \"double\" : \"float\";\n\t\t\t// MySQL doesn't let you cast to TEXT/LONGTEXT\n\t\t\tcase CHAR, VARCHAR, LONG32VARCHAR, CLOB, ENUM -> \"char\";\n\t\t\tcase NCHAR, NVARCHAR, LONG32NVARCHAR, NCLOB -> \"char character set utf8mb4\";\n\t\t\t// MySQL doesn't let you cast to BLOB/TINYBLOB/LONGBLOB","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/dialect/aggregate/MySQLAggregateSupport.java#L122-L158","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 (MySQL).","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 (MySQL).","solutions":["Map the aggregate column with a supported SQL type (JSON).","Avoid the unsupported aggregate type on MySQL."],"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"}