source: Git/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieRatesPK.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: 964 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 MovieRatesPK implements Serializable {
13
14 @Column(name = "movie_id")
15 private int movieId;
16
17 @Column(name = "user_id")
18 private int userId;
19
20
21 public MovieRatesPK() {
22 }
23
24 public MovieRatesPK(int movieId, int userId) {
25 this.movieId = movieId;
26 this.userId = userId;
27 }
28
29 @Override
30 public boolean equals(Object o) {
31 if (this == o) return true;
32 if (o == null || getClass() != o.getClass()) return false;
33
34 MovieRatesPK that = (MovieRatesPK) o;
35
36
37
38 return movieId == that.movieId && userId == that.userId;
39 }
40
41 @Override
42 public int hashCode() {
43 int result = movieId;
44 result = 31 * result + userId;
45 return result;
46 }
47}
Note: See TracBrowser for help on using the repository browser.