{"record":{"id":"8a89c7faa5b4421c","repo":"hibernate/hibernate-orm","slug":"property-path-is-the-inverse-side-of-a-oneto","errorCode":null,"errorMessage":"Property '<path>' is the inverse side of a '@OneToOne' association and cannot be used as identifier","messagePattern":"Property '<path>' is the inverse side of a '@OneToOne' 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":473,"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 oneToOne = memberDetails.getDirectAnnotationUsage( OneToOne.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 '@OneToOne' association and may not use '@Column' to specify column mappings\"\n\t\t\t\t\t\t\t+ \" (use '@PrimaryKeyJoinColumn' instead)\"\n\t\t\t);\n\t\t}\n\n\t\tif ( joinColumns.hasMappedBy() && 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 '@OneToOne' association and cannot be used as identifier\"\n\t\t\t);\n\t\t}\n\n\t\t//FIXME support a proper PKJCs\n\t\tfinal boolean trueOneToOne = memberDetails.hasDirectAnnotationUsage( PrimaryKeyJoinColumn.class )\n\t\t\t\t|| memberDetails.hasDirectAnnotationUsage( PrimaryKeyJoinColumns.class );\n\t\tbindOneToOne(\n\t\t\t\taggregateCascadeTypes( oneToOne.cascade(), memberDetails, oneToOne.orphanRemoval(), context ),\n\t\t\t\tjoinColumns,\n\t\t\t\toneToOne.optional(),\n\t\t\t\toneToOne.fetch(),\n\t\t\t\tpropertyHolder,\n\t\t\t\tnullability,\n\t\t\t\tinferredData,\n\t\t\t\tnullIfEmpty( oneToOne.mappedBy() ),\n\t\t\t\ttrueOneToOne,","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ToOneBinder.java#L455-L491","documentation":"Error \"Property '<path>' is the inverse side of a '@OneToOne' 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"}