{"record":{"id":"5006e5e66dfede27","repo":"hibernate/hibernate-orm","slug":"could-not-determine-target-type-for-dynamic-attrib-5006e5","errorCode":null,"errorMessage":"Could not determine target type for dynamic attribute","messagePattern":"Could not determine target type for dynamic attribute","errorType":"exception","errorClass":"HibernateException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/DynamicModelHelper.java","lineNumber":669,"sourceCode":"\tprivate static TypeDetails determineAttributeJavaTypeDetails(\n\t\t\tJaxbManagedType declaringType,\n\t\t\tJaxbEmbeddedMapping jaxbEmbeddedMapping,\n\t\t\tXmlDocumentContext xmlDocumentContext) {\n\t\tfinal String target = jaxbEmbeddedMapping.getTarget();\n\t\tif ( isNotEmpty( target ) ) {\n\t\t\tfinal ModelsContext modelsContext = xmlDocumentContext.getBootstrapContext().getModelsContext();\n\t\t\tfinal ClassDetails memberTypeClassDetails = ModelsHelper.resolveClassDetails(\n\t\t\t\t\ttarget,\n\t\t\t\t\txmlDocumentContext,\n\t\t\t\t\tmodelsContext.getClassDetailsRegistry(),\n\t\t\t\t\t() -> new DynamicClassDetails( target, modelsContext )\n\t\t\t);\n\n\t\t\treturn new ClassTypeDetailsImpl( memberTypeClassDetails, TypeDetails.Kind.CLASS );\n\t\t}\n\n\t\t// todo : need more context here for better exception message\n\t\tthrow new HibernateException( \"Could not determine target type for dynamic attribute\" );\n\t}\n\n\t/**\n\t * Determine the appropriate TypeDetails for the given association mapping.\n\t * Handles {@code <one-to-one/>}, {@code <many-to-one/>}, {@code <one-to-many/>}, {@code <many-to-many/>}\n\t */\n\tprivate static TypeDetails determineAttributeJavaTypeDetails(\n\t\t\tJaxbAssociationAttribute jaxbAssociationAttribute,\n\t\t\tXmlDocumentContext xmlDocumentContext) {\n\t\tfinal String target = jaxbAssociationAttribute.getTargetEntity();\n\t\tif ( isNotEmpty( target ) ) {\n\t\t\tfinal var modelsContext = xmlDocumentContext.getBootstrapContext().getModelsContext();\n\t\t\tfinal var classDetails = ModelsHelper.resolveClassDetails(\n\t\t\t\t\ttarget,\n\t\t\t\t\txmlDocumentContext,\n\t\t\t\t\tmodelsContext.getClassDetailsRegistry(),\n\t\t\t\t\t() -> new DynamicClassDetails(\n\t\t\t\t\t\t\ttarget,","sourceCodeStart":651,"sourceCodeEnd":687,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/models/xml/internal/DynamicModelHelper.java#L651-L687","documentation":"Error \"Could not determine target type for dynamic attribute\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An hbm.xml / orm.xml mapping document violates a mapping rule during bootstrap.","commonSituations":"Legacy XML mappings with invalid combinations (column+formula, mixed inheritance, missing identifiers, bad extends references).","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."],"exampleFix":"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.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}