hibernate/hibernate-orm · error · IllegalArgumentException

Expecting BasicPluralJavaType for array class '{}[]', but go

Error message

Expecting BasicPluralJavaType for array class '{}[]', but got '{}'

What it means

Error "Expecting BasicPluralJavaType for array class '{}[]', but got '{}'" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/loader/ast/internal/MultiKeyLoadHelper.java:43

	public static JdbcMapping resolveArrayJdbcMapping(
			JdbcMapping keyMapping,
			Class<?> elementClass,
			SessionFactoryImplementor sessionFactory) {
		final var arrayBasicType =
				sessionFactory.getTypeConfiguration().getBasicTypeRegistry()
						.getRegisteredArrayType( elementClass );
		if ( arrayBasicType != null ) {
			return arrayBasicType;
		}

		final var typeConfiguration = sessionFactory.getTypeConfiguration();

		final var rawArrayJavaType =
				typeConfiguration.getJavaTypeRegistry()
						.resolveArrayDescriptor( elementClass );
		if ( !(rawArrayJavaType instanceof BasicPluralJavaType<?> arrayJavaType ) ) {
			throw new IllegalArgumentException( "Expecting BasicPluralJavaType for array class '"
												+ elementClass.getTypeName() + "[]', but got '"
												+ rawArrayJavaType + "'" );
		}

		//noinspection unchecked,rawtypes
		return arrayJavaType.resolveType(
				typeConfiguration,
				sessionFactory.getJdbcServices().getDialect(),
				// potentially problematic - custom id type
				(BasicType) keyMapping,
				null,
				typeConfiguration.getCurrentBaseSqlTypeIndicators()
		);
	}

	static int countIds(Object[] ids) {
		int count = 0;
		for ( int i=1; i<ids.length; i++ ) {

View on GitHub (pinned to fad1729dce)

Solutions

  1. Map the array attribute with a supported basic plural type; check the @JdbcTypeCode/type mapping for the array.

When it happens

Trigger: Thrown at hibernate-core/src/main/java/org/hibernate/loader/ast/internal/MultiKeyLoadHelper.java:43 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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