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:
964 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 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.