hibernate/hibernate-orm · error · HibernateException
Could not determine target type for dynamic attribute
Error message
Could not determine target type for dynamic attribute
What it means
An <embedded> attribute in a dynamic model provided neither a resolvable target nor any way to infer the attribute's Java type. The target attribute of the embedded mapping is missing/unresolvable; specify it so Hibernate can build the dynamic embeddable type.
Solutions
- 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.
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/5006e5e66dfede27.
Report an issue: GitHub.
Appendix: source
Thrown at hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/DynamicModelHelper.java:669
private static TypeDetails determineAttributeJavaTypeDetails(
JaxbManagedType declaringType,
JaxbEmbeddedMapping jaxbEmbeddedMapping,
XmlDocumentContext xmlDocumentContext) {
final String target = jaxbEmbeddedMapping.getTarget();
if ( isNotEmpty( target ) ) {
final ModelsContext modelsContext = xmlDocumentContext.getBootstrapContext().getModelsContext();
final ClassDetails memberTypeClassDetails = ModelsHelper.resolveClassDetails(
target,
xmlDocumentContext,
modelsContext.getClassDetailsRegistry(),
() -> new DynamicClassDetails( target, modelsContext )
);
return new ClassTypeDetailsImpl( memberTypeClassDetails, TypeDetails.Kind.CLASS );
}
// todo : need more context here for better exception message
throw new HibernateException( "Could not determine target type for dynamic attribute" );
}
/**
* Determine the appropriate TypeDetails for the given association mapping.
* Handles {@code <one-to-one/>}, {@code <many-to-one/>}, {@code <one-to-many/>}, {@code <many-to-many/>}
*/
private static TypeDetails determineAttributeJavaTypeDetails(
JaxbAssociationAttribute jaxbAssociationAttribute,
XmlDocumentContext xmlDocumentContext) {
final String target = jaxbAssociationAttribute.getTargetEntity();
if ( isNotEmpty( target ) ) {
final var modelsContext = xmlDocumentContext.getBootstrapContext().getModelsContext();
final var classDetails = ModelsHelper.resolveClassDetails(
target,
xmlDocumentContext,
modelsContext.getClassDetailsRegistry(),
() -> new DynamicClassDetails(
target,View on GitHub (pinned to fad1729dce)