ManyToMany relationship leads to StackOverFlow error
问题 I have an entity called User which has set of roles. I also have a Role entity which has set of users.( This is just a practice application for learning purposes.) public class User { private String firstName; private String lastName; @ManyToMany @JoinTable(name="user_role", joinColumns={@JoinColumn(name="user_id")}, inverseJoinColumns={@JoinColumn(name="role_id")}) private Set<Role> roles; //getters setters } public class Role { private String name; @ManyToMany(mappedBy="roles") private Set