hibernate/hibernate-orm · error · IllegalAttributeType
A "virtual id" cannot define <any/> attributes : {}
Error message
A "virtual id" cannot define <any/> attributes : {} What it means
Error "A "virtual id" cannot define <any/> attributes : {}" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/VirtualIdEmbeddable.java:221
String[] rootTableKeyColumnNames,
MappingModelCreationProcess creationProcess) {
final var attributeMappings = new ImmutableAttributeMappingList.Builder( compositeType.getPropertyNames().length );
return finishInitialization(
navigableRole,
bootDescriptor,
compositeType,
rootTableExpression,
rootTableKeyColumnNames,
this,
representationStrategy,
(attributeName, attributeType) -> {
if ( attributeType instanceof CollectionType ) {
throw new IllegalAttributeType( "A \"virtual id\" cannot define collection attributes : " + attributeName );
}
if ( attributeType instanceof AnyType ) {
throw new IllegalAttributeType( "A \"virtual id\" cannot define <any/> attributes : " + attributeName );
}
},
(column, jdbcEnvironment) -> MappingModelCreationHelper.getTableIdentifierExpression( column.getValue().getTable(), creationProcess ),
attributeMappings::add,
() -> {
this.attributeMappings = attributeMappings.build();
// We need the attribute mapping types to finish initialization first before we can build the column mappings
creationProcess.registerInitializationCallback(
"VirtualIdEmbeddable(" + navigableRole + ")#initColumnMappings",
this::initColumnMappings
);
},
creationProcess
);
}
@Override
public boolean areEqual(@Nullable Object one, @Nullable Object other, SharedSessionContractImplementor session) {View on GitHub (pinned to fad1729dce)
Solutions
- Remove <any/> attributes from the virtual id mapping; use basic or to-one attributes for the identifier.
When it happens
Trigger: Thrown when an entity with a virtual id embeddable declares <any/> attributes as part of its identifier mapping.
Common situations: See trigger scenarios.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/8f62b72efb1ea9b2.
Report an issue: GitHub.