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
|
Rev | Line | |
---|
[5b447b0] | 1 | package com.wediscussmovies.project.model.primarykeys;
|
---|
| 2 |
|
---|
| 3 | import lombok.Data;
|
---|
| 4 |
|
---|
| 5 | import javax.persistence.*;
|
---|
| 6 | import java.io.Serializable;
|
---|
| 7 |
|
---|
| 8 |
|
---|
| 9 | @Data
|
---|
| 10 | @Embeddable
|
---|
| 11 | public 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.