I've got fk in child, but i need @JoinColumn in parent. By default, in OneToOne, joincolumn creates fk in parent table (where it is specified), i have existing tables with fk in child. (project new demands) Before it was mapped using mappedBy clause.
How can I use @JoinColumn for @OneToOne linking in the parent entity?
I want to make unidirectional relationship.
Why cant I use this:
@JoinColumn(name = "parent_id", referencedColumn = "childs_fk")
ty!
Update:
In this example FK column "WEBSITE_ID" would be in Player table. My FK is in Website table.
In a bi-directional OneToOne relationship, a single foreign key is used in the owning side of the relationship. On the other hand, the target entity must use the mappedBy attribute.
I've got existing tables and my fk is not on the owner side, + I know for a fact that FK could be on both sides. This answer is not what I need.