source: Git/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieLikesPK.java@ 5b447b0

main
Last change on this file since 5b447b0 was 5b447b0, checked in by Test <matonikolov77@…>, 2 years ago

Adding models and resources

  • Property mode set to 100644
File size: 961 bytes
Line 
1package com.wediscussmovies.project.model.primarykeys;
2
3import lombok.Data;
4
5import javax.persistence.Column;
6import javax.persistence.Embeddable;
7import javax.persistence.Id;
8import java.io.Serializable;
9
10@Embeddable
11@Data
12public class MovieLikesPK implements Serializable {
13
14 @Column(name = "movie_id")
15 private int movieId;
16
17 @Column(name = "user_id")
18 private int userId;
19
20 public MovieLikesPK() {
21 }
22
23 public MovieLikesPK(int movieId, int userId) {
24 this.movieId = movieId;
25 this.userId = userId;
26 }
27
28 @Override
29 public boolean equals(Object o) {
30 if (this == o) return true;
31 if (o == null || getClass() != o.getClass()) return false;
32
33 MovieLikesPK that = (MovieLikesPK) o;
34
35 return userId == that.userId && movieId == that.movieId;
36 }
37
38 @Override
39 public int hashCode() {
40 int result = movieId;
41 result = 31 * result + userId;
42 return result;
43 }
44}
Note: See TracBrowser for help on using the repository browser.