hibernate/hibernate-orm · error · UnsupportedOperationException

Unsupported fetchable type: {}

Error message

Unsupported fetchable type: {}

What it means

Error "Unsupported fetchable type: {}" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/query/results/internal/dynamic/DynamicFetchBuilderLegacy.java:142

		}
		else if ( fetchable instanceof PluralAttributeMapping pluralAttributeMapping ) {
			if ( propertyName.equals( "key" ) ) {
				return pluralAttributeMapping.getIndexDescriptor();
			}
			else if ( propertyName.equals( "element" ) ) {
				return pluralAttributeMapping.getElementDescriptor().getCollectionAttribute();
			}
			else {
				final var elementDescriptor = pluralAttributeMapping.getElementDescriptor();
				if ( elementDescriptor instanceof EntityCollectionPart entityCollectionPart ) {
					if ( propertyName.startsWith( ELEMENT_PREFIX ) ) {
						propertyName = propertyName.substring( ELEMENT_PREFIX_LENGTH );
					}
					return (Fetchable) entityCollectionPart.getEntityMappingType().findByPath( propertyName );
				}
			}
		}
		throw new UnsupportedOperationException( "Unsupported fetchable type: " + fetchable.getClass().getName() );
	}

	@Override
	public NativeQuery.ReturnProperty addProperty(String propertyName) {
		return addProperty( resolveFetchable( propertyName ) );
	}

	@Override
	public DynamicFetchBuilderLegacy cacheKeyInstance() {
		return new DynamicFetchBuilderLegacy(
				tableAlias,
				ownerTableAlias,
				fetchable,
				columnNames == null ? null : List.copyOf( columnNames ),
				fetchBuilderMap(),
				resultBuilderEntity == null ? null : resultBuilderEntity.cacheKeyInstance()
		);
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. The attribute type cannot be fetched here. Only associations (to-one/to-many) can be fetched in a result mapping.

When it happens

Trigger: A dynamic native-result mapping is built inconsistently: Unsupported fetchable type: <value>

Common situations: Defining the same fetch twice, fetching an unsupported type, or an instantiation mapping with no constructor arguments.


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