I am trying to achieve @OneToOne association, using the same @Id between a Car and a Person. A Person is has an
@OneToOne
@Id
Car
Person
(Disclaimer: It was not meant to be a Q&A)
The problem is in @MapsId annotation. Changing it to:
@MapsId
@MapsId("name") //Here @OneToOne @JoinColumn(name = "name") @OnDelete(action = OnDeleteAction.CASCADE) private Person person;
seems to fix the problem.