hibernate/hibernate-orm · error · ModelsException
Embeddable did not define class nor name
Error message
Embeddable did not define class nor name
What it means
An <embeddable> XML mapping declared neither class nor name. Every embeddable needs an identifying class (POJO mapping) or name (dynamic mapping); supply one of the two attributes.
Solutions
- Set either the class or name attribute on the <embeddable/> element in the XML mapping.
Example fix
Set either the class or name attribute on the <embeddable/> element in the XML mapping.
Defensive patterns
Strategy: validation
When it happens
Trigger: An hbm.xml / orm.xml mapping document violates a mapping rule during bootstrap.
Common situations: Legacy XML mappings with invalid combinations (column+formula, mixed inheritance, missing identifiers, bad extends references).
AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22).
Data as JSON: /api/errors/a3ef2d92521337b5.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/ManagedTypeProcessor.java:690
XmlAnnotationHelper.applyLifecycleCallbacks( jaxbClass, classDetails, xmlDocumentContext );
}
public static void processCompleteEmbeddable(
JaxbEntityMappingsImpl jaxbRoot,
JaxbEmbeddableImpl jaxbEmbeddable,
XmlDocumentContext xmlDocumentContext) {
final MutableClassDetails classDetails;
final AccessType classAccessType;
final AttributeProcessor.MemberAdjuster memberAdjuster;
final var classDetailsRegistry =
xmlDocumentContext.getModelBuildingContext()
.getClassDetailsRegistry();
if ( isEmpty( jaxbEmbeddable.getClazz() ) ) {
if ( isEmpty( jaxbEmbeddable.getName() ) ) {
throw new ModelsException( "Embeddable did not define class nor name" );
}
// no class == dynamic...
classDetails = (MutableClassDetails) ModelsHelper.resolveClassDetails(
jaxbEmbeddable.getName(),
xmlDocumentContext,
classDetailsRegistry,
() -> new DynamicClassDetails( jaxbEmbeddable.getName(),
xmlDocumentContext.getModelBuildingContext() )
);
classAccessType = AccessType.FIELD;
memberAdjuster = ManagedTypeProcessor::adjustDynamicTypeMember;
prepareDynamicClass( classDetails, jaxbEmbeddable, xmlDocumentContext );
}
else {
final String className = XmlProcessingHelper.determineClassName( jaxbRoot, jaxbEmbeddable );
classDetails = (MutableClassDetails) classDetailsRegistry.resolveClassDetails( className );
classAccessType = coalesce(View on GitHub (pinned to fad1729dce)