main
Last change
on this file since c02189f was 5b447b0, checked in by Test <matonikolov77@…>, 2 years ago |
Adding models and resources
|
-
Property mode
set to
100644
|
File size:
961 bytes
|
Rev | Line | |
---|
[5b447b0] | 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 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.