{"record":{"id":"8f31fd03b9946d11","repo":"hibernate/hibernate-orm","slug":"property-path-is-a-onetoone-association-and","errorCode":null,"errorMessage":"Property '<path>' is a '@OneToOne' association and may not use '@Column' to specify column mappings (use '@PrimaryKeyJoinColumn' instead)","messagePattern":"Property '<path>' is a '@OneToOne' association and may not use '@Column' to specify column mappings \\(use '@PrimaryKeyJoinColumn' instead\\)","errorType":"exception","errorClass":"AnnotationException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/model/internal/ToOneBinder.java","lineNumber":465,"sourceCode":"\t\t\t\t? context.getEffectiveDefaults().isDefaultEntityLaziness() ? LAZY : EAGER\n\t\t\t\t: specifiedType;\n\t}\n\n\tstatic void bindOneToOne(\n\t\t\tPropertyHolder propertyHolder,\n\t\t\tNullability nullability,\n\t\t\tPropertyData inferredData,\n\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 ),","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ToOneBinder.java#L447-L483","documentation":"Error \"Property '<path>' is a '@OneToOne' association and may not use '@Column' to specify column mappings (use '@PrimaryKeyJoinColumn' instead)\" 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":["Replace @Column on the @OneToOne association with @JoinColumn (or @PrimaryKeyJoinColumn when the primary key is shared).","Column mappings belong on basic attributes only; move any column customization to the join column of the association."],"exampleFix":"Replace @Column on the @OneToOne association with @JoinColumn (or @PrimaryKeyJoinColumn when the primary key is shared).","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"}