{"record":{"id":"2dde6002eedfe85b","repo":"hibernate/hibernate-orm","slug":"entity-s-did-not-define-an-identifier","errorCode":null,"errorMessage":"Entity [%s] did not define an identifier","messagePattern":"Entity \\[(.+?)\\] did not define an identifier","errorType":"exception","errorClass":"MappingException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/EntityHierarchySourceImpl.java","lineNumber":87,"sourceCode":"\n\t\tthis.caching = Helper.createCaching( entityElement().getCache() );\n\t\tthis.naturalIdCaching = Helper.createNaturalIdCaching(\n\t\t\t\trootEntitySource.jaxbEntityMapping().getNaturalIdCache()\n\t\t);\n\n\t\tcollectedEntityNames.add( rootEntitySource.getEntityNamingSource().getEntityName() );\n\t}\n\n\tpublic MappingDocument getRootEntityMappingDocument() {\n\t\treturn rootEntityMappingDocument;\n\t}\n\n\tprivate static IdentifierSource interpretIdentifierSource(RootEntitySourceImpl rootEntitySource) {\n\t\tfinal JaxbHbmSimpleIdType simpleId = rootEntitySource.jaxbEntityMapping().getId();\n\t\tfinal JaxbHbmCompositeIdType compositeId = rootEntitySource.jaxbEntityMapping().getCompositeId();\n\n\t\tif ( simpleId == null && compositeId == null ) {\n\t\t\tthrow new MappingException(\n\t\t\t\t\tString.format(\n\t\t\t\t\t\t\tLocale.ROOT,\n\t\t\t\t\t\t\t\"Entity [%s] did not define an identifier\",\n\t\t\t\t\t\t\trootEntitySource.getEntityNamingSource().getEntityName()\n\t\t\t\t\t),\n\t\t\t\t\trootEntitySource.origin()\n\t\t\t);\n\t\t}\n\n\t\tif ( simpleId != null ) {\n\t\t\treturn new IdentifierSourceSimpleImpl( rootEntitySource );\n\t\t}\n\t\telse {\n\t\t\t// if we get here, we should have a composite identifier.  Just need\n\t\t\t// to determine if it is aggregated, or non-aggregated...\n\n\t\t\tif ( compositeId.isMapped() ) {\n\t\t\t\tif ( StringHelper.isEmpty( compositeId.getClazz() ) ) {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/EntityHierarchySourceImpl.java#L69-L105","documentation":"Error \"Entity [%s] did not define an identifier\" 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":["Add an <id/> (or <composite-id/>) mapping for the entity in the hbm.xml document."],"exampleFix":"Add an <id/> (or <composite-id/>) mapping for the entity in the hbm.xml document.","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"}