#16 board: hashcode, equals

This commit is contained in:
haerong22
2023-01-19 00:20:38 +09:00
parent 7dc0502f23
commit 8d62ba1f92
3 changed files with 6 additions and 6 deletions

View File

@@ -62,11 +62,11 @@ public class Article extends AuditingFields {
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Article article)) return false;
return id != null && id.equals(article.id);
return this.getId() != null && this.getId().equals(article.getId());
}
@Override
public int hashCode() {
return Objects.hash(id);
return Objects.hash(this.getId());
}
}

View File

@@ -50,11 +50,11 @@ public class ArticleComment extends AuditingFields {
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ArticleComment that)) return false;
return id != null && id.equals(that.id);
return this.getId() != null && this.getId().equals(that.getId());
}
@Override
public int hashCode() {
return Objects.hash(id);
return Objects.hash(this.getId());
}
}

View File

@@ -54,12 +54,12 @@ public class UserAccount extends AuditingFields {
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof UserAccount userAccount)) return false;
return userId != null && userId.equals(userAccount.userId);
return this.getUserId() != null && this.getUserId().equals(userAccount.getUserId());
}
@Override
public int hashCode() {
return Objects.hash(userId);
return Objects.hash(this.getUserId());
}
}