package com.wediscussmovies.project.model; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.io.Serializable; public class MovieActorsEntityPK implements Serializable { @Column(name = "movie_id") @Id private int movieId; @Column(name = "actor_id") @Id private int actorId; public int getMovieId() { return movieId; } public void setMovieId(int movieId) { this.movieId = movieId; } public int getActorId() { return actorId; } public void setActorId(int actorId) { this.actorId = actorId; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MovieActorsEntityPK that = (MovieActorsEntityPK) o; if (movieId != that.movieId) return false; if (actorId != that.actorId) return false; return true; } @Override public int hashCode() { int result = movieId; result = 31 * result + actorId; return result; } }