I am new to Spring Boot. I tried to do an Authentication module where user can Register and Login Based in their role. I have written the logic for user registration and then when I run this it's not running but show me:
Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Repeated column in mapping for collection: net.osmanforhad.main.model.User.roles column: user_id
here is the many to many relation code:
@Column(name = "roles")
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(
name = "users_roles",
joinColumns = @JoinColumn(
name = "user_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(
name = "user_id", referencedColumnName = "id"
)
)
private Collection<Role> roles;
is there any one to suggest me how i should fix this issue . Thanks in advance