hibernate/hibernate-orm · error · AnnotationException
Entity class '${className}' is annotated '@ConcreteProxy' bu
Error message
Entity class '${className}' is annotated '@ConcreteProxy' but it is not the root of the entity inheritance hierarchy What it means
Error "Entity class '${className}' is annotated '@ConcreteProxy' but it is not the root of the entity inheritance hierarchy" thrown in hibernate/hibernate-orm.
Source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java:1829
else {
final String discriminatorTypeName = discriminator.getType().getName();
return switch ( discriminatorTypeName ) {
case "string" -> name; //Spec compliant
case "integer"-> String.valueOf( name.hashCode() ); // TODO: pretty nasty, should we just deprecate/disallow this?
default -> throw new MappingException( "Entity '" + name + "' must explicitly specify its '@DiscriminatorValue'" );
};
}
}
else {
return discriminatorValue.value();
}
}
private void bindConcreteProxy() {
final var concreteProxy = annotatedClass.getAnnotationUsage( ConcreteProxy.class, modelsContext() );
if ( concreteProxy != null ) {
if ( persistentClass.getSuperclass() != null ) {
throw new AnnotationException( "Entity class '" + persistentClass.getClassName()
+ "' is annotated '@ConcreteProxy' but it is not the root of the entity inheritance hierarchy" );
}
persistentClass.getRootClass().setConcreteProxy( true );
}
}
private void bindSqlRestriction() {
final var restriction = extractSQLRestriction( annotatedClass );
if ( restriction != null ) {
where = restriction.value();
}
}
private SQLRestriction extractSQLRestriction(ClassDetails classDetails) {
final var modelsContext = modelsContext();
final var fromClass = getOverridableAnnotation( classDetails, SQLRestriction.class, context );
if ( fromClass != null ) {
return fromClass;View on GitHub (pinned to fad1729dce)
Solutions
- Move @ConcreteProxy to the root class of the entity inheritance hierarchy.
When it happens
Trigger: An annotation restricted to the root of an inheritance hierarchy is placed on a subclass (or the hierarchy rules are otherwise violated).
Common situations: SINGLE_TABLE/JOINED hierarchies where @Table, @DiscriminatorColumn, @DiscriminatorFormula, @Cache, @Immutable, @Id or @Version are declared on the wrong class of the hierarchy.
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/069f6362b05c9f36.
Report an issue: GitHub.