Account for hasMany relationships in equals and hashCode
问题 I would like to use the @EqualsAndHashCode annotation on my domain classes, but it seems the equals and hashCode methods generated by that annotation don't take hasMany fields into account. I don't see any way to change this with the annotation, but I'm hoping that I'm missing something because it is very convenient (if it works). 回答1: Define the hasMany relationship as a Set in the parent domain class, which we normally do not do as it is redundant. You also have to make sure you are using