{"record":{"id":"9a5fb9f8cc14712c","repo":"hibernate/hibernate-orm","slug":"cannot-combine-mapped-true-with-specified-name","errorCode":null,"errorMessage":"cannot combine mapped=\"true\" with specified name","messagePattern":"cannot combine mapped=\"true\" with specified name","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/EntityHierarchySourceImpl.java","lineNumber":124,"sourceCode":"\t\t\t\t\tthrow new MappingException(\n\t\t\t\t\t\t\t\"mapped composite identifier must name component class to use.\",\n\t\t\t\t\t\t\trootEntitySource.origin()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( StringHelper.isEmpty( compositeId.getName() ) ) {\n\t\t\t\tif ( compositeId.isMapped() && StringHelper.isEmpty( compositeId.getClazz() ) ) {\n\t\t\t\t\tthrow new MappingException(\n\t\t\t\t\t\t\t\"mapped composite identifier must name component class to use.\",\n\t\t\t\t\t\t\trootEntitySource.origin()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn new IdentifierSourceNonAggregatedCompositeImpl( rootEntitySource );\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif ( compositeId.isMapped() ) {\n\t\t\t\t\tthrow new MappingException(\n\t\t\t\t\t\t\t\"cannot combine mapped=\\\"true\\\" with specified name\",\n\t\t\t\t\t\t\trootEntitySource.origin()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn new IdentifierSourceAggregatedCompositeImpl( rootEntitySource );\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static VersionAttributeSource interpretVersionSource(RootEntitySourceImpl rootEntitySource) {\n\t\tfinal JaxbHbmRootEntityType entityElement = rootEntitySource.jaxbEntityMapping();\n\t\tif ( entityElement.getVersion() != null ) {\n\t\t\treturn new VersionAttributeSourceImpl(\n\t\t\t\t\trootEntitySource.sourceMappingDocument(),\n\t\t\t\t\trootEntitySource,\n\t\t\t\t\tentityElement.getVersion()\n\t\t\t);\n\t\t}","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/EntityHierarchySourceImpl.java#L106-L142","documentation":"Error \"cannot combine mapped=\"true\" with specified name\" 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":["Remove the name attribute when mapped=\"true\" is set on the identifier, or drop mapped=\"true\"."],"exampleFix":"Remove the name attribute when mapped=\"true\" is set on the identifier, or drop mapped=\"true\".","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"}