title: JPA : relation with other column than id
body: <p>When I do a relation one to one with to entities, JPA use the id to register the target ; but I should want an other column. How is possible ?</p>
  
  <p>For instance I have two entities :</p>
  
  <pre><code>@Entity
  public class Target
  {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private String id;
  
    @Column(unique=true, nullable=false)
    private String code;
  
   // and so on 
  }
  </code></pre>
  
  <p>That's make a table with columns ID and CODE. </p>
  
  <p>A second entity with a link to Coder :</p>
  
  <pre><code>@Entity
  public class ToTarget
  {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private String id;
  
   private Target targeted;
  
   // and so on 
  }
  </code></pre>
  
  <p>That's make a table with column ID and TARGET_ID. In TARGET_ID I have some id from column ID in table Target.</p>
  
  <p>All is good, but I should want, in TARGET_ID, some code value from table Coder. How is it possible ?</p>
  
  <p>Thanks.</p>