hibernate/hibernate-orm · error · IllegalArgumentException

Unsupported jakarta.persistence.sql.MappingElement type : {}

Error message

Unsupported jakarta.persistence.sql.MappingElement type : {}

What it means

Error "Unsupported jakarta.persistence.sql.MappingElement type : {}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/results/internal/jpa/JpaMappingHelper.java:91

		else {
			throw new IllegalArgumentException( "Unsupported jakarta.persistence.sql.ResultSetMapping type : " + jpaMapping.getClass().getName() );
		}
	}

	public static <T> MappingElementBuilder<T> toHibernateBuilder(
			jakarta.persistence.sql.MappingElement<T> jpaMapping,
			SessionFactoryImplementor sessionFactory) {
		if ( jpaMapping instanceof ColumnMapping<T> columnMapping ) {
			return new ColumnBuilder<>( columnMapping, sessionFactory );
		}
		else if ( jpaMapping instanceof ConstructorMapping<T> constructorMapping ) {
			return new ConstructorBuilder<>( constructorMapping, sessionFactory );
		}
		else if ( jpaMapping instanceof EntityMapping<T> entityMapping ) {
			return new EntityBuilder<>( entityMapping, sessionFactory );
		}
		else {
			throw new IllegalArgumentException( "Unsupported jakarta.persistence.sql.MappingElement type : " + jpaMapping.getClass().getName() );
		}
	}

	public static <T> jakarta.persistence.sql.ResultSetMapping<T> makeJpaMapping(
			Class<T> entityType,
			SessionFactoryImplementor sessionFactory) {
		var entityDescriptor = sessionFactory.getMappingMetamodel().getEntityDescriptor( entityType );
		final EntityDiscriminatorMapping discriminatorMapping = entityDescriptor.getDiscriminatorMapping();
		return entity(
				entityType,
				discriminatorMapping == null ? null : discriminatorMapping.getSelectableName(),
				collectMemberMappings( entityType, entityDescriptor, sessionFactory )
		);
	}

	private static <T> MemberMapping<T>[] collectMemberMappings(
			Class<T> entityType,
			EntityMappingType entityTypeDescriptor,

View on GitHub (pinned to fad1729dce)

Solutions

  1. The MappingElement type is not supported. Use a supported mapping element (EntityResult, ColumnResult, ...).

When it happens

Trigger: A runtime precondition of the Hibernate query API is violated: Unsupported jakarta.persistence.sql.MappingElement type : <value>

Common situations: Application code or configuration calls the query API in a way that violates its documented contract; the interpolated values in the message identify the offending input.


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