hibernate/hibernate-orm · error · IllegalArgumentException

"Unsupported aggregate SQL type: " + aggregateSqlTypeCode

Error message

"Unsupported aggregate SQL type: " + aggregateSqlTypeCode

What it means

Error ""Unsupported aggregate SQL type: " + aggregateSqlTypeCode" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/dialect/aggregate/DB2AggregateSupport.java:423

	@Override
	public WriteExpressionRenderer aggregateCustomWriteExpressionRenderer(
			SelectableMapping aggregateColumn,
			SelectableMapping[] columnsToUpdate,
			TypeConfiguration typeConfiguration) {
		final int aggregateSqlTypeCode = aggregateColumn.getJdbcMapping().getJdbcType().getDefaultSqlTypeCode();
		switch ( aggregateSqlTypeCode ) {
			case JSON:
				if ( jsonSupport ) {
					return new RootJsonWriteExpression( aggregateColumn, columnsToUpdate );
				}
				break;
			case SQLXML:
				return new RootXmlWriteExpression( aggregateColumn, columnsToUpdate );
			case STRUCT:
				return new RootStructWriteExpression( aggregateColumn, columnsToUpdate, typeConfiguration );
		}
		throw new IllegalArgumentException( "Unsupported aggregate SQL type: " + aggregateSqlTypeCode );
	}

	private static String castTypeName(Column udtColumn, TypeConfiguration typeConfiguration) {
		return getCastTypeName(
				new SqlTypedMappingImpl(
						udtColumn.getLength(),
						udtColumn.getArrayLength(),
						udtColumn.getPrecision(),
						udtColumn.getScale(),
						udtColumn.getTemporalPrecision(),
						udtColumn.getType()
				),
				typeConfiguration
		);
	}

	interface AggregateWriteExpression {
		void append(

View on GitHub (pinned to fad1729dce)

Solutions

  1. Map the aggregate with a supported SQL type.
  2. Avoid the unsupported aggregate type on DB2.

When it happens

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

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


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