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/MySQLAggregateSupport.java:140

								);
							}
							else {
								return template.replace(
										placeholder,
										"unhex(replace(json_unquote(" + queryExpression( aggregateParentReadExpression,
												columnExpression ) + "),'-',''))"
								);
							}
						}
						// Fall-through intended
					default:
						return template.replace(
								placeholder,
								valueExpression( aggregateParentReadExpression, columnExpression, columnCastType( column, typeConfiguration ) )
						);
				}
		}
		throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateColumnTypeCode );
	}

	private String columnCastType(SqlTypedMapping column, TypeConfiguration typeConfiguration) {
		return switch (column.getJdbcMapping().getJdbcType().getDdlTypeCode()) {
			// special case for casting to Boolean
			case BOOLEAN, BIT -> "unsigned";
			// MySQL doesn't let you cast to INTEGER/BIGINT/TINYINT
			case TINYINT, SMALLINT, INTEGER, BIGINT -> "signed";
			case REAL -> "float";
			case DOUBLE -> "double";
			case FLOAT -> jsonType
					// In newer versions of MySQL, casting to float/double is supported
					? getCastTypeName( column, typeConfiguration )
					: column.getPrecision() == null || column.getPrecision() == 53 ? "double" : "float";
			// MySQL doesn't let you cast to TEXT/LONGTEXT
			case CHAR, VARCHAR, LONG32VARCHAR, CLOB, ENUM -> "char";
			case NCHAR, NVARCHAR, LONG32NVARCHAR, NCLOB -> "char character set utf8mb4";
			// MySQL doesn't let you cast to BLOB/TINYBLOB/LONGBLOB

View on GitHub (pinned to fad1729dce)

Solutions

  1. Map the aggregate column with a supported SQL type (JSON).
  2. Avoid the unsupported aggregate type on MySQL.

When it happens

Trigger: Triggered when the application calls a Hibernate dialect feature that the configured database dialect cannot provide: Unsupported aggregate SQL type (MySQL).

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 (MySQL).


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/fef99eb177421e71. Report an issue: GitHub.