hibernate/hibernate-orm · error · UnsupportedMappingException
Only basic and to-one attributes are supported in composite
Error message
Only basic and to-one attributes are supported in composite fks
What it means
Error "Only basic and to-one attributes are supported in composite fks" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java:252
attributeMapping = toOne;
currentIndex += attributeMapping.getJdbcTypeCount();
}
else if ( attributeMapping instanceof EmbeddableValuedModelPart embeddableValuedModelPart ) {
final var subMappings = new SelectableMapping[attributeMapping.getJdbcTypeCount()];
for ( int i = 0; i < subMappings.length; i++ ) {
subMappings[i] = selectableMappings.getSelectable( currentIndex++ );
}
attributeMapping = MappingModelCreationHelper.createInverseModelPart(
embeddableValuedModelPart,
declaringType,
declaringTableGroupProducer,
new SelectableMappingsImpl( subMappings ),
creationProcess
);
}
else {
throw new UnsupportedMappingException(
"Only basic and to-one attributes are supported in composite fks" );
}
mappings.add( attributeMapping );
}
attributeMappings = mappings.build();
buildGetterSetterCache();
return true;
}
protected boolean finishInitialization(
NavigableRole navigableRole,
Component bootDescriptor,
CompositeType compositeType,
String rootTableExpression,
String[] rootTableKeyColumnNames,
EmbeddableMappingType declarer,
EmbeddableRepresentationStrategy representationStrategy,
AttributeTypeValidator attributeTypeValidator,View on GitHub (pinned to fad1729dce)
Solutions
- Map the foreign key of the embedded id/reference using only basic attributes and to-one associations; move collections or other unsupported attributes out of the key.
When it happens
Trigger: Thrown when a composite foreign key includes an attribute that is neither basic nor to-one (e.g. a plural or any attribute inside an embeddable key).
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/34bec19b61ced54f.
Report an issue: GitHub.