{"record":{"id":"5e7f6df8258ee4fd","repo":"hibernate/hibernate-orm","slug":"unsupported-fetchable-type","errorCode":null,"errorMessage":"Unsupported fetchable type: {}","messagePattern":"Unsupported fetchable type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/query/results/internal/dynamic/DynamicFetchBuilderLegacy.java","lineNumber":142,"sourceCode":"\t\t}\n\t\telse if ( fetchable instanceof PluralAttributeMapping pluralAttributeMapping ) {\n\t\t\tif ( propertyName.equals( \"key\" ) ) {\n\t\t\t\treturn pluralAttributeMapping.getIndexDescriptor();\n\t\t\t}\n\t\t\telse if ( propertyName.equals( \"element\" ) ) {\n\t\t\t\treturn pluralAttributeMapping.getElementDescriptor().getCollectionAttribute();\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfinal var elementDescriptor = pluralAttributeMapping.getElementDescriptor();\n\t\t\t\tif ( elementDescriptor instanceof EntityCollectionPart entityCollectionPart ) {\n\t\t\t\t\tif ( propertyName.startsWith( ELEMENT_PREFIX ) ) {\n\t\t\t\t\t\tpropertyName = propertyName.substring( ELEMENT_PREFIX_LENGTH );\n\t\t\t\t\t}\n\t\t\t\t\treturn (Fetchable) entityCollectionPart.getEntityMappingType().findByPath( propertyName );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthrow new UnsupportedOperationException( \"Unsupported fetchable type: \" + fetchable.getClass().getName() );\n\t}\n\n\t@Override\n\tpublic NativeQuery.ReturnProperty addProperty(String propertyName) {\n\t\treturn addProperty( resolveFetchable( propertyName ) );\n\t}\n\n\t@Override\n\tpublic DynamicFetchBuilderLegacy cacheKeyInstance() {\n\t\treturn new DynamicFetchBuilderLegacy(\n\t\t\t\ttableAlias,\n\t\t\t\townerTableAlias,\n\t\t\t\tfetchable,\n\t\t\t\tcolumnNames == null ? null : List.copyOf( columnNames ),\n\t\t\t\tfetchBuilderMap(),\n\t\t\t\tresultBuilderEntity == null ? null : resultBuilderEntity.cacheKeyInstance()\n\t\t);\n\t}","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/query/results/internal/dynamic/DynamicFetchBuilderLegacy.java#L124-L160","documentation":"Error \"Unsupported fetchable type: {}\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A dynamic native-result mapping is built inconsistently: Unsupported fetchable type: <value>","commonSituations":"Defining the same fetch twice, fetching an unsupported type, or an instantiation mapping with no constructor arguments.","solutions":["The attribute type cannot be fetched here. Only associations (to-one/to-many) can be fetched in a result mapping."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}