main
Last change
on this file was 980eeda, checked in by Test <matonikolov77@…>, 2 years ago |
Restructuring project
|
-
Property mode
set to
100644
|
File size:
974 bytes
|
Line | |
---|
1 | package com.wediscussmovies.project.model.primarykeys;
|
---|
2 |
|
---|
3 | import lombok.Data;
|
---|
4 |
|
---|
5 | import javax.persistence.Column;
|
---|
6 | import javax.persistence.Embeddable;
|
---|
7 | import javax.persistence.Id;
|
---|
8 | import java.io.Serializable;
|
---|
9 |
|
---|
10 | @Embeddable
|
---|
11 | @Data
|
---|
12 | public 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.