File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
src/main/java/com/back/domain/user/entity Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1414import java .util .ArrayList ;
1515import java .util .Collection ;
1616import java .util .List ;
17+ import java .util .Objects ;
1718
1819@ Entity
1920@ Table (name = "users" ) // 예약어 충돌 방지를 위해 "users" 권장
@@ -70,6 +71,17 @@ public class User {
7071 @ OneToMany (mappedBy = "user" , cascade = CascadeType .ALL , orphanRemoval = true )
7172 private List <PostLike > postLikes = new ArrayList <>();
7273
74+ @ Override
75+ public boolean equals (Object o ) {
76+ if (o == null || getClass () != o .getClass ()) return false ;
77+ User user = (User ) o ;
78+ return Objects .equals (id , user .id );
79+ }
80+
81+ @ Override
82+ public int hashCode () {
83+ return Objects .hashCode (id );
84+ }
7385
7486 public boolean isAdmin () {
7587 return "ADMIN" .equalsIgnoreCase (role );
You can’t perform that action at this time.
0 commit comments