How to change the @OneToOne shared primary key column name with JPA and Hibernate

Introduction In this article, we are going to see how you can change the @OneToOne shared primary key column name when using JPA and Hibernate. This has been a recurrent theme when answering questions about Hibernate or during my High-Performance Java Persistence training. As previously explained, the one-to-one database table relationship requires the Primary Key to be shared among the parent and the child tables. Unfortunately, just adding the JPA @OneToOne annotation in the child entity does not render a true one-to-one table relationship since a separate Foreign Key column will be… Read More