title: JPA one-to-one mapping creates an extra column. How to remove it?
body: <p>I have one-to-one mapping JPA table in my springboot application which works fine.
  The <code>Users</code> is the parent table and in the <code>account_no</code> column, it stores the foreign key. Which is, child's primary key. The child is <code>Account</code> table.</p>
  <p>However, when the application is started, I can see that there is one additional column (<code>user_id</code>) that has been created in H2 DB. I think it is something wrong with my JPA mapping. Pls help to figure it out. Below are the two classes.</p>
  <pre><code>@Entity
  public class User extends AbstractEntity {
  
      // Other fields related to user entity go here ..
  
      @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = false)
      @JoinColumn(name = &quot;account_no&quot;, referencedColumnName = &quot;account_num&quot;)
      private Account account;
  }
  
  @Entity
  public class Account extends AbstractEntity{
  
      // fields like account#, balance etc goes here..
  
      @Column(name=&quot;account_num&quot;, unique = true)
      @NotNull
      private long accountNo;
  
      @OneToOne (fetch = FetchType.LAZY)
      private User user;
  }
     
  </code></pre>
  <hr />
  <p>Startup log.</p>
  <pre><code> create table account (id bigint not null,  account_num bigint not null, bal float not null, user_id bigint, primary key (id))
  2021-12-22 00:09:28.765 DEBUG 25380 --- [           main] org.hibernate.SQL                        : 
  </code></pre>