{"record":{"id":"4d02e6b6adde1539","repo":"hibernate/hibernate-orm","slug":"embeddable-class-componentclassname-may-not-be","errorCode":null,"errorMessage":"Embeddable class '<componentClassName>' may not be used as an '@EmbeddedId' by '<path>' because it has no properties","messagePattern":"Embeddable class '<componentClassName>' may not be used as an '@EmbeddedId' by '<path>' because it has no properties","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java","lineNumber":375,"sourceCode":"\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,\n\t\t\tPropertyData inferredData,\n\t\t\tAccessType propertyAccessor,\n\t\t\tboolean isNullable,\n\t\t\tEntityBinder entityBinder,\n\t\t\tboolean isComponentEmbedded,\n\t\t\tboolean isIdentifierMapper,\n\t\t\tboolean inSecondPass,\n\t\t\tClass<? extends EmbeddableInstantiator> customInstantiatorImpl,","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EmbeddableBinder.java#L357-L393","documentation":"Error \"Embeddable class '<componentClassName>' may not be used as an '@EmbeddedId' by '<path>' because it has no properties\" 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":["Add persistent properties to the embeddable class, or use a different class as the @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"}