title: How to use @OnetoMany with Embeddedid
body: <p>I am working on hibernate and tying to associate mapping with @OneToMany relationship with composite key.
  Following are the entities that currently my using .</p>
  
  <pre><code>@Embeddable
  @Getter
  @Setter
  public class AddressKey implements Serializable {
  
      private static final long serialVersionUID = -307823488229761699L;
  
      @Column(name = "id")
      private Long id;
  
      @Column(name = "city")
      private Long city;
  
      @Column(name = "locale")
      private String locale;
  
      @Column(name = "type")
      private String type;
  
      @ManyToOne
      @JoinColumn(name="id")
      private Person person;
  }
  
  @Entity
  @Table(name = "address", schema = "test")
  @Setter
  @Getter
  public class AddressHistory {
  
      @EmbeddedId
      private AddressKey key;
  
      @Column(name = "active")
      private boolean active;
  
      @Column(name = "current")
      private boolean current;
  
  }
  
  
  @Entity
  @Table(name = "person", schema="test")
  @ToString
  public class Person {
  
      @Id
      @Column(name = "id")
      private Long id;
  
      @OneToMany(mappedBy="key.person", fetch=FetchType.EAGER, cascade=CascadeType.ALL)
      private Set&lt;AddressHistory&gt; addressHistory;
  }
  </code></pre>
  
  <p>But when I am trying to run this program it gives me following error. </p>
  
  <p>repeated column in mapping for entity  AddressHistory. </p>
  
  <p>Someone help me to fix this what's wrong in this mapping. 
  Thanks in advance </p>