hibernate/hibernate-orm · error · AnnotationException
Unknown entity name '{}'
Error message
Unknown entity name '{}' What it means
Error "Unknown entity name '{}'" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/BasicValueBinder.java:1491
@Override
public String getReferencedEntityName() {
return referencedEntityName;
}
@Override
public boolean isInPrimaryKey() {
// @MapsId is not itself in the primary key,
// so it's safe to simply process it after all the primary keys have been processed.
return true;
}
@Override
public void doSecondPass(Map<String, PersistentClass> persistentClasses) {
final var referencedEntity = persistentClasses.get( referencedEntityName );
if ( referencedEntity == null ) {
// TODO: much better error message if this is something that can really happen!
throw new AnnotationException( "Unknown entity name '" + referencedEntityName + "'" );
}
linkJoinColumnWithValueOverridingNameIfImplicit(
referencedEntity,
referencedEntity.getKey(),
joinColumns,
value
);
}
}
}
View on GitHub (pinned to fad1729dce)
Solutions
- Correct the entity name to one that is registered in the persistence unit.
- If a custom entity name is used, make sure it matches the name declared in @Entity(name=...).
When it happens
Trigger: An association or reference targets a type that Hibernate has not mapped as an entity.
Common situations: Missing @Entity on the target class, the class not being scanned into the persistence unit, or a typo in the entity name.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/b3a65ddb73fa0811.
Report an issue: GitHub.