hibernate/hibernate-orm · error · ModelsException

Embeddable did not define class nor name

Error message

Embeddable did not define class nor name

What it means

Error "Embeddable did not define class nor name" thrown in hibernate/hibernate-orm.

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)

Solutions

  1. 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.

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.