title: Hibernate annotation with common column for foreign and primary key
body: <p>I am having some issues modeling a foreign key the way I like it in hibernate 4.1.9</p>
  
  <p>I basically have the following code:</p>
  
  <pre><code>@Entity
  @XmlRootElement
  @Table(name="User")
  public class UserVO
  {
      private String email;
  
      @Id
      @Column(name="email", unique=true, nullable=false)
      @XmlElement
      public String getEmail()
      {
          return this.email;
      }
  }
  </code></pre>
  
  <p>and this:</p>
  
  <pre><code>@Entity
  @XmlRootElement
  @Table(name="Authentification")
  public class AuthentificationVO
  {
      private String email;
      private UserVO user;
  
      @Id 
      @Column(name="email", unique=true, nullable=false)
      @XmlElement
      public String getEmail()
      {
          return this.email;
      }
  
      @OneToOne(cascade = CascadeType.ALL)
      @ForeignKey(name="user_fk")
      public UserVO getUser()
      {
          return this.user;
      }
  }
  </code></pre>
  
  <p>The point of it all, is to have a column named email in both tables, which should also serve as a primary key for both the User and Authentification tables. For some reason, when I run this, Hibernate insists on adding a column to the Authentification table called user_email, but I want it to use the already existing column named email.</p>
  
  <p>I tried looking around for a solution for this and I have tried using mappedBy annotation to get it right, along with JoinColumn, but nothing seems to do the trick. </p>