hibernate/hibernate-orm · error · UnknownAttributeTypeException

Could not determine target type for dynamic attribute [%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:438

			case LIST -> {
				collectionClassDetails = listType( classDetailsRegistry );
				typeParams = List.of( elementType );
			}
			case SET -> {
				collectionClassDetails = setType( jaxbPluralAttribute, classDetailsRegistry );
				typeParams = List.of( elementType );
			}
			case MAP -> {
				collectionClassDetails = mapType( jaxbPluralAttribute, classDetailsRegistry );
				// for now, just use wildcard for the key
				final ClassDetails objectClassDetails = classDetailsRegistry.resolveClassDetails( OBJECT_CLASS_NAME );
				typeParams = List.of(
						new WildcardTypeDetailsImpl( new ClassTypeDetailsImpl( objectClassDetails, TypeDetails.Kind.CLASS ), true ),
						elementType
				);
			}
			default -> {
				throw new UnknownAttributeTypeException(
						String.format(
								Locale.ROOT,
								"Could not determine target type for dynamic attribute [%s, %s]",
								declaringType,
								jaxbPluralAttribute.getName()
						)
				);
			}
		}

		return new ParameterizedTypeDetailsImpl( collectionClassDetails, typeParams, declaringType );
	}

	private static ClassDetails collectionType(MutableClassDetailsRegistry classDetailsRegistry) {
		if ( COLLECTION_CLASS_DETAILS == null ) {
			COLLECTION_CLASS_DETAILS = classDetailsRegistry.getClassDetails( Collection.class.getName() );
		}
		return COLLECTION_CLASS_DETAILS;

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