Hibernate metamodel initialization fails on nested Embeddable that implements MappedSuperclass
Description
Activity
Show:
Marco Belladelli November 13, 2024 at 9:05 AM
Might be somewhat related to , though I suspect the cause here is slightly different.
Details
Details
Assignee
Reporter
Worked in
Sprint
None
Affects versions
Priority
Created October 31, 2024 at 12:59 PM
Updated February 25, 2025 at 1:32 PM
The issue is highly likely related to the
Hibernate metamodel initialization fails when there is no implementation found for a MappedSupperclass i.e.
getSubTypes()
is empty in the line below though there is an Embeddable implementing the MappedSuperclass.Stacktrace:
To reproduce create a nested embeddable like:
Here, both
AuditBase
andVersionBase
are considered as unusedMappedSuperclass when building metamodel context. The context will be processed successfully in case whenAuditBase
processed first andVersionBase
processed after. And it will fail when theVersionBase
processed beforeAuditBase
likely due to the fact thatVersionInfo
implementation ofVersionBase
gets known only after processingAuditBase
which uses it as its property type. Unfortunately unused@MappedSuperclass
are not ordered in the metadata context and thus build success depends on a random order.Possible solution is to order unused mappedsuperclass entries somehow to get
AuditBase
always processed beforeVersionBase
from the example above.