{"record":{"id":"1558e37e1fc61888","repo":"hibernate/hibernate-orm","slug":"embeddable-class-componentclassname-may-not-ha","errorCode":null,"errorMessage":"Embeddable class '<componentClassName>' may not have a property annotated '@Id' since it is used by '<path>' as an '@EmbeddedId'","messagePattern":"Embeddable class '<componentClassName>' may not have a property annotated '@Id' since it is used by '<path>' as an '@EmbeddedId'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java","lineNumber":367,"sourceCode":"\t\tbinder.setMemberDetails( inferredData.getAttributeMember() );\n\t\tbinder.setAccessType( inferredData.getDefaultAccess() );\n\t\tbinder.setEmbedded( isComponentEmbedded );\n\t\tbinder.setHolder( propertyHolder );\n\t\tbinder.setId( isId );\n\t\tbinder.setEntityBinder( entityBinder );\n\t\tbinder.setInheritanceStatePerClass( inheritanceStatePerClass );\n\t\tbinder.setBuildingContext( context );\n\t\tbinder.makePropertyAndBind();\n\t\treturn binder;\n\t}\n\n\tprivate static void checkEmbeddedId(\n\t\t\tPropertyData inferredData,\n\t\t\tPropertyHolder propertyHolder,\n\t\t\tString referencedEntityName,\n\t\t\tComponent embeddable) {\n\t\tif ( propertyHolder.getPersistentClass().getIdentifier() != null ) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Embeddable class '\" + embeddable.getComponentClassName()\n\t\t\t\t\t\t\t+ \"' may not have a property annotated '@Id' since it is used by '\"\n\t\t\t\t\t\t\t+ getPath(propertyHolder, inferredData)\n\t\t\t\t\t\t\t+ \"' as an '@EmbeddedId'\"\n\t\t\t);\n\t\t}\n\t\tif ( referencedEntityName == null && embeddable.getPropertySpan() == 0 ) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Embeddable class '\" + embeddable.getComponentClassName()\n\t\t\t\t\t\t\t+ \"' may not be used as an '@EmbeddedId' by '\"\n\t\t\t\t\t\t\t+ getPath(propertyHolder, inferredData)\n\t\t\t\t\t\t\t+ \"' because it has no properties\"\n\t\t\t);\n\t\t}\n\t}\n\n\tstatic Component fillEmbeddable(\n\t\t\tPropertyHolder propertyHolder,","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java#L349-L385","documentation":"Error \"Embeddable class '<componentClassName>' may not have a property annotated '@Id' since it is used by '<path>' as an '@EmbeddedId'\" thrown in hibernate/hibernate-orm.","triggerScenarios":"A composite identifier mapping (@IdClass/@EmbeddedId/@MapsId) does not match the entity's persistent properties.","commonSituations":"Composite primary keys where the id class properties, their types, or @MapsId values drift out of sync with the entity, or an embeddable with inheritance is reused as an id.","solutions":["Remove @Id from the embeddable property, or stop using the embeddable as an @EmbeddedId."],"exampleFix":null,"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"}