insert the image description here
The diary_place table is being created with 2 user_id field, I want it to be only a user_id referenced as foreign key for the diary and place tables.
I want the result to be the same as the second image.
@ManyToMany(cascade=CascadeType.ALL)
@JoinTable(name ="diary_place",
joinColumns = {
@JoinColumn(name = "diary_id", referencedColumnName="id"),
@JoinColumn(name = "d_user_id", referencedColumnName="user_id" )
},
inverseJoinColumns = {
@JoinColumn(name = "place_id", referencedColumnName="id", nullable=false),
@JoinColumn(name = "p_user_id", referencedColumnName="user_id")
},
foreignKey=@ForeignKey(name="fk_diary"),
inverseForeignKey=@ForeignKey(name="fk_place")
)
private List <Place> places;