source: Git/src/main/java/com/wediscussmovies/project/model/primarykeys/MovieActorsPK.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: 904 bytes
Line 
1package com.wediscussmovies.project.model.primarykeys;
2
3import lombok.Data;
4
5import javax.persistence.*;
6import java.io.Serializable;
7
8
9@Data
10@Embeddable
11public class MovieActorsPK implements Serializable {
12
13 @Column(name = "movie_id")
14 private int movieId;
15
16 @Column(name = "actor_id")
17 private int actorId;
18
19 public MovieActorsPK(int movieId, int actorId) {
20 this.movieId = movieId;
21 this.actorId = actorId;
22 }
23
24 public MovieActorsPK() {
25 }
26
27 @Override
28 public boolean equals(Object o) {
29 if (this == o) return true;
30 if (o == null || getClass() != o.getClass()) return false;
31
32 MovieActorsPK that = (MovieActorsPK) o;
33
34 return actorId == that.actorId && movieId == that.movieId;
35 }
36
37 @Override
38 public int hashCode() {
39 int result = movieId;
40 result = 31 * result + actorId;
41 return result;
42 }
43}
Note: See TracBrowser for help on using the repository browser.