hibernate/hibernate-orm · error · UnknownAttributeTypeException

Could not determine target type for dynamic attribute [%s#%s

Error message

Could not determine target type for dynamic attribute [%s#%s]

What it means

Error "Could not determine target type for dynamic attribute [%s#%s]" thrown in hibernate/hibernate-orm.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/DynamicModelHelper.java:599

		if ( jaxbBasicMapping instanceof JaxbBasicImpl jaxbBasicAttribute ) {
			final var temporalType = jaxbBasicAttribute.getTemporal();
			if ( temporalType != null ) {
				return resolveTemporalJavaType( temporalType, xmlDocumentContext );
			}
		}

		final String declaringTypeName;
		if ( declaringType instanceof JaxbEntity jaxbEntity ) {
			declaringTypeName = nullIfEmpty( jaxbEntity.getName() );
		}
		else if ( declaringType instanceof JaxbEmbeddable jaxbEmbeddable ) {
			declaringTypeName = nullIfEmpty( jaxbEmbeddable.getName() );
		}
		else {
			declaringTypeName = null;
		}

		throw new UnknownAttributeTypeException(
				String.format(
						Locale.ROOT,
						"Could not determine target type for dynamic attribute [%s#%s]",
						declaringTypeName != null ? declaringTypeName : declaringType.getClazz(),
						jaxbBasicMapping.getName()
				)
		);
	}

	/**
	 * Conceptually very similar to {@linkplain SimpleTypeInterpretation}, but here the distinction between
	 * primitive and wrapper ({@code boolean} and {@code Boolean} e.g.) is important while in
	 * SimpleTypeInterpretation we only care about the wrapper.
	 */
	private static ClassDetails resolveBasicMappingTarget(SimpleTypeInterpretation targetInterpretation, XmlDocumentContext xmlDocumentContext) {
		final var modelsContext = xmlDocumentContext.getBootstrapContext().getModelsContext();
		final var classDetailsRegistry = modelsContext.getClassDetailsRegistry();
		return classDetailsRegistry.resolveClassDetails( targetInterpretation.getJavaType().getName() );

View on GitHub (pinned to fad1729dce)

Solutions

  1. Specify the attribute target type explicitly in the XML mapping (target/target-class/class attribute) since it cannot be inferred for a dynamic (Map) model.

Example fix

Specify the attribute target type explicitly in the XML mapping (target/target-class/class attribute) since it cannot be inferred for a dynamic (Map) model.

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/fe7876705d077ed0. Report an issue: GitHub.