{"record":{"id":"757cdb197da456d3","repo":"hibernate/hibernate-orm","slug":"property-path-is-the-inverse-side-of-a-manyt","errorCode":null,"errorMessage":"Property '<path>' is the inverse side of a '@ManyToOne' association and cannot be used as identifier","messagePattern":"Property '<path>' is the inverse side of a '@ManyToOne' association and cannot be used as identifier","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/ToOneBinder.java","lineNumber":93,"sourceCode":"\t\t\tboolean isIdentifierMapper,\n\t\t\tboolean inSecondPass,\n\t\t\tMetadataBuildingContext context,\n\t\t\tAnnotatedJoinColumns joinColumns,\n\t\t\tPropertyBinder propertyBinder) {\n\t\tfinal var memberDetails = inferredData.getAttributeMember();\n\t\tfinal var manyToOne = memberDetails.getDirectAnnotationUsage( ManyToOne.class );\n\n\t\t//check validity\n\t\tif ( memberDetails.hasDirectAnnotationUsage( Column.class ) ) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Property '\" + getPath( propertyHolder, inferredData )\n\t\t\t\t\t\t\t+ \"' is a '@ManyToOne' association and may not use '@Column' to specify column mappings (use '@JoinColumn' instead)\"\n\t\t\t);\n\t\t}\n\n\t\tif ( joinColumns.hasMappedBy()\n\t\t\t\t&& isIdentifier( propertyHolder, propertyBinder, isIdentifierMapper ) ) {\n\t\t\tthrow new AnnotationException(\n\t\t\t\t\t\"Property '\" + getPath( propertyHolder, inferredData )\n\t\t\t\t\t\t\t+ \"' is the inverse side of a '@ManyToOne' association and cannot be used as identifier\"\n\t\t\t);\n\t\t}\n\n\t\tbindManyToOne(\n\t\t\t\taggregateCascadeTypes( manyToOne.cascade(), memberDetails, false, context ),\n\t\t\t\tjoinColumns,\n\t\t\t\tpropertyHolder,\n\t\t\t\tnullability,\n\t\t\t\tinferredData,\n\t\t\t\tmanyToOne.fetch(),\n\t\t\t\tmanyToOne.optional(),\n\t\t\t\tfalse,\n\t\t\t\tisIdentifierMapper,\n\t\t\t\tinSecondPass,\n\t\t\t\tpropertyBinder,\n\t\t\t\tcontext","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ToOneBinder.java#L75-L111","documentation":"Error \"Property '<path>' is the inverse side of a '@ManyToOne' association and cannot be used as identifier\" thrown in hibernate/hibernate-orm.","triggerScenarios":"An entity mapping annotation or bootstrap configuration violates a Hibernate mapping rule.","commonSituations":"Annotation mapping mistakes: inverse-side @Id associations, @Column on @OneToOne, unmapped association targets, mismatched @EnumeratedValue/@Temporal usage, duplicate sequence generators.","solutions":["Make the owning side the identifier: put @Id (and @MapsId if deriving the id) on the side that owns the foreign key, and mark the inverse side with mappedBy.","If you only need a plain association, remove @Id from the inverse-side property so it is not used as the identifier."],"exampleFix":"Make the owning side the identifier: put @Id (and @MapsId if deriving the id) on the side that owns the foreign key, and mark the inverse side with mappedBy.","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"}