I have a simple class Role:
@Entity @Table (name = \"ROLE\") public class Role implements Serializable { @Id @GeneratedValue private Integer id;
Knowing when overriding the hashCode and equals is not an easy task, there is another discussion where you have example and documentation link here What issues should be considered when overriding equals and hashCode in Java?