source: Git/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieGenresPK.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: 974 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 MovieGenresPK implements Serializable {
13
14 @Column(name = "movie_id")
15 private int movieId;
16
17 @Column(name = "genre_id")
18 private int genreId;
19
20 public MovieGenresPK(int movieId, int genreId) {
21 this.movieId = movieId;
22 this.genreId = genreId;
23 }
24
25 public MovieGenresPK() {
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 MovieGenresPK that = (MovieGenresPK) o;
34
35 return genreId == that.genreId && movieId == that.movieId;
36 }
37
38 @Override
39 public int hashCode() {
40 int result = movieId;
41 result = 31 * result + genreId;
42 return result;
43 }
44}
Note: See TracBrowser for help on using the repository browser.