{"record":{"id":"ed7a43e74dd9800e","repo":"hibernate/hibernate-orm","slug":"entity-entityname-has-id-annotated-properti","errorCode":null,"errorMessage":"Entity '<entityName>' has '@Id' annotated properties <properties> which do not match properties of the specified '@IdClass'","messagePattern":"Entity '<entityName>' has '@Id' annotated properties <properties> which do not match properties of the specified '@IdClass'","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java","lineNumber":1160,"sourceCode":"\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tinheritanceStates\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmissingIdProperties.remove( propertyName );\n\t\t\t}\n\t\t}\n\t\taddGenericProperties( persistentClass, inheritanceState, inheritanceStates );\n\n\t\tif ( !missingIdProperties.isEmpty() ) {\n\t\t\tthrow new AnnotationException( \"Entity '\" + persistentClass.getEntityName()\n\t\t\t\t\t+ \"' has an '@IdClass' with properties \" + getMissingPropertiesString( missingIdProperties )\n\t\t\t\t\t+ \" which do not match properties of the entity class\" );\n\t\t}\n\t\telse if ( !missingEntityProperties.isEmpty() ) {\n\t\t\tthrow new AnnotationException( \"Entity '\" + persistentClass.getEntityName()\n\t\t\t\t\t+ \"' has '@Id' annotated properties \" + getMissingPropertiesString( missingEntityProperties )\n\t\t\t\t\t+ \" which do not match properties of the specified '@IdClass'\" );\n\t\t}\n\t}\n\n\tprivate static Nullability getNullability(InheritanceState inheritanceState, MemberDetails memberDetails) {\n\t\tif ( isVersion( memberDetails ) ) {\n\t\t\treturn Nullability.FORCED_NOT_NULL;\n\t\t}\n\t\telse {\n\t\t\treturn inheritanceState.getType() == SINGLE_TABLE\n\t\t\t\t&& inheritanceState.hasParents()\n\t\t\t\t\t? Nullability.FORCED_NULL\n\t\t\t\t\t: Nullability.NO_CONSTRAINT;\n\t\t}\n\t}\n\n\tprivate void addGenericProperties(","sourceCodeStart":1142,"sourceCodeEnd":1178,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1142-L1178","documentation":"Error \"Entity '<entityName>' has '@Id' annotated properties <properties> which do not match properties of the specified '@IdClass'\" 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":["Align the entity @Id properties with the properties of the specified @IdClass."],"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"}