From: Roland Häder Date: Tue, 23 Aug 2016 14:47:03 +0000 (+0200) Subject: Always include primary key (id number) in equal() method X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=7bd18b3e18d933b5a0a0cb61d8cddd24c147266c;p=juser-core.git Always include primary key (id number) in equal() method --- diff --git a/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java b/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java index 2d8d738..718c4c5 100644 --- a/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java +++ b/src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java @@ -173,11 +173,15 @@ public class EmailAddressChange implements ChangeableEmailAddress { final ChangeableEmailAddress otherEmail = (ChangeableEmailAddress) object; - if (!Objects.equals(this.getEmailAddress(), otherEmail.getEmailAddress())) { + if (!Objects.equals(this.getEmailChangeId(), otherEmail.getEmailChangeId())) { + return false; + } else if (!Objects.equals(this.getEmailAddress(), otherEmail.getEmailAddress())) { + return false; + } else if (!Objects.equals(this.getEmailChangeUser(), otherEmail.getEmailChangeUser())) { return false; } - return Objects.equals(this.getEmailChangeUser(), otherEmail.getEmailChangeUser()); + return true; } @Override @@ -257,8 +261,11 @@ public class EmailAddressChange implements ChangeableEmailAddress { @Override public int hashCode () { int hash = 5; + + hash = 71 * hash + Objects.hashCode(this.getEmailChangeId()); hash = 71 * hash + Objects.hashCode(this.getEmailAddress()); hash = 71 * hash + Objects.hashCode(this.getEmailChangeUser()); + return hash; } diff --git a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java b/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java index 270ac6d..1cbdef1 100644 --- a/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java +++ b/src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java @@ -119,9 +119,9 @@ public class UserPasswordHistory implements PasswordHistory { final PasswordHistory other = (PasswordHistory) object; - if (!Objects.equals(this.getUserPasswordHistoryPasswordHash(), other.getUserPasswordHistoryPasswordHash())) { + if (!Objects.equals(this.getUserPasswordHistoryId(), other.getUserPasswordHistoryId())) { return false; - } else if (!Objects.equals(this.getUserPasswordHistoryId(), other.getUserPasswordHistoryId())) { + } else if (!Objects.equals(this.getUserPasswordHistoryPasswordHash(), other.getUserPasswordHistoryPasswordHash())) { return false; } else if (!Objects.equals(this.getUserPasswordHistoryUser(), other.getUserPasswordHistoryUser())) { return false;