]> git.mxchange.org Git - juser-core.git/commitdiff
Always include primary key (id number) in equal() method
authorRoland Häder <roland@mxchange.org>
Tue, 23 Aug 2016 14:47:03 +0000 (16:47 +0200)
committerRoland Häder <roland@mxchange.org>
Tue, 23 Aug 2016 14:47:03 +0000 (16:47 +0200)
src/org/mxchange/jusercore/model/email_address/EmailAddressChange.java
src/org/mxchange/jusercore/model/user/password_history/UserPasswordHistory.java

index 2d8d7383d41482a724d1a4f9b9d8d5f961a5cfb0..718c4c5bc68c5d031728b1f8ff4b53cda4154a1d 100644 (file)
@@ -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;
        }
 
index 270ac6d05825ab43801e19b1ddcc23e0eee950d1..1cbdef126952bf145a0d565711d688425ec63637 100644 (file)
@@ -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;