I want to create the following relationship.
Code:
User(1)--------(n)UserBoard(n)-----(1)Board
                         |(1)
                         |                               
                         |(n) 
               UserBoardField
                         |(n)
                         |
                         |(1)
                      Field
And I tried this:
Code:
@Entity
@Table(name = "user_board_fields")
public class UserBoardField implements Serializable, Comparable {
   @Embeddable
    public static class Id implements Serializable {
   private UserBoard.Id ubId;
   @Column(name = "FIELD_ID")
   private Long fieldId;
   public Id() {
   }
   public Id(UserBoard.Id ubId, Long fieldId) {
       this.ubId = ubId;
       this.fieldId = fieldId;
   }
         ......
    }
@EmbeddedId
    private Id id = new Id();
    @ManyToOne
    private UserBoard  ub;
    @ManyToOne
    @JoinColumn(name = "FIELD_ID", insertable = false, updatable = false)
    private Profilefield field;
   ......
}
The above code runs and generates the user_board_fields table. But the ids are duplicated as shown below.
Code:
USER_ID 
BOARD_ID
FIELD_ID
ub_USER_ID
ub_BOARD_ID
How can I create this kind of relationship? 
Thank you very much in advance.