Skip to content

Commit

Permalink
Sonar: This class overrides 'equals()' and should therefore also over…
Browse files Browse the repository at this point in the history
…ride 'hashCode()
  • Loading branch information
qmonmert committed May 31, 2024
1 parent 136dec3 commit 1f64781
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@ public class <%= user.dtoClass %> implements Serializable {
Objects.equals(getLogin(), userDTO.getLogin());
}

@Override
public int hashCode() {
return Objects.hash(
getId(),
<%_ for (const { propertyJavaFilterName } of user.fields.filter(field => !field.builtIn && field.relatedByOtherEntity)) { _%>
<%- propertyJavaFilterName %>,
<%_ } _%>
getLogin()
);
}

// prettier-ignore
@Override
public String toString() {
Expand Down

0 comments on commit 1f64781

Please sign in to comment.