ClassCastException: org.hibernate.mapping.SingleTableSubclass cannot be cast to org.hibernate.mapping.RootClass

Description

When extending from an @NaturalIdCache annotated entity then following exception raises during MetadataBuilding:

java.lang.ClassCastException: org.hibernate.mapping.SingleTableSubclass cannot be cast to org.hibernate.mapping.RootClass
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.addEntityBinding(InFlightMetadataCollectorImpl.java:312)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:808)
at org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies(AnnotationMetadataSourceProcessorImpl.java:250)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess$1.processEntityHierarchies(MetadataBuildingProcess.java:231)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:274)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:84)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:474)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:1)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:689)
...

Environment

None

Status

Assignee

Chris Cranford

Reporter

Guenther Demetz

Fix versions

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

Affirmative

backportDecision

None

Worked in

5.2.15

Affects versions

Priority

Major
Configure