{"record":{"id":"3f0cb3313e3eb582","repo":"hibernate/hibernate-orm","slug":"entity-entityname-has-an-idclass-with-prope","errorCode":null,"errorMessage":"Entity '<entityName>' has an '@IdClass' with properties <properties> which do not match properties of the entity class","messagePattern":"Entity '<entityName>' has an '@IdClass' with properties <properties> which do not match properties of the entity class","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java","lineNumber":1155,"sourceCode":"\t\t\t\t\t\t\tgetNullability( inheritanceState, memberDetails ),\n\t\t\t\t\t\t\tpropertyAnnotatedElement,\n\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\tfalse,\n\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","sourceCodeStart":1137,"sourceCodeEnd":1173,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java#L1137-L1173","documentation":"Error \"Entity '<entityName>' has an '@IdClass' with properties <properties> which do not match properties of the entity class\" 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":["Make the @IdClass properties match the entity identifier properties in name and type."],"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"}