[6e7b472] | 1 | package com.wediscussmovies.project.model;
|
---|
| 2 |
|
---|
| 3 | import javax.persistence.*;
|
---|
| 4 | import java.sql.Date;
|
---|
[2d57cad] | 5 | import java.util.Collection;
|
---|
| 6 | import java.util.Objects;
|
---|
[6e7b472] | 7 |
|
---|
[2d57cad] | 8 | @Entity
|
---|
| 9 | @Table(name = "movies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
[6e7b472] | 10 | public class Movie {
|
---|
[2d57cad] | 11 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[6e7b472] | 12 | @Id
|
---|
[2d57cad] | 13 | @Column(name = "movie_id")
|
---|
| 14 | private int movieId;
|
---|
| 15 | @Basic
|
---|
| 16 | @Column(name = "title")
|
---|
| 17 | private String title;
|
---|
| 18 | @Basic
|
---|
| 19 | @Column(name = "description")
|
---|
| 20 | private String description;
|
---|
| 21 | @Basic
|
---|
| 22 | @Column(name = "image_url")
|
---|
| 23 | private String imageUrl;
|
---|
| 24 | @Basic
|
---|
| 25 | @Column(name = "airing_date")
|
---|
| 26 | private Date airingDate;
|
---|
| 27 | @Basic
|
---|
| 28 | @Column(name = "imdb_rating")
|
---|
| 29 | private Double imdbRating;
|
---|
| 30 | @Basic
|
---|
| 31 | @Column(name = "director_id")
|
---|
| 32 | private Integer directorId;
|
---|
| 33 | @OneToMany(mappedBy = "moviesByMovieId")
|
---|
| 34 | private Collection<Discussion> discussionsByMovieId;
|
---|
| 35 | @OneToMany(mappedBy = "moviesByMovieId")
|
---|
| 36 | private Collection<MovieActorsEntity> movieActorsByMovieId;
|
---|
| 37 | @OneToMany(mappedBy = "moviesByMovieId")
|
---|
| 38 | private Collection<MovieGenresEntity> movieGenresByMovieId;
|
---|
| 39 | @OneToMany(mappedBy = "moviesByMovieId")
|
---|
| 40 | private Collection<MovieLikesEntity> movieLikesByMovieId;
|
---|
| 41 | @OneToMany(mappedBy = "moviesByMovieId")
|
---|
| 42 | private Collection<MovieRatesEntity> movieRatesByMovieId;
|
---|
| 43 | @ManyToOne
|
---|
| 44 | @JoinColumn(name = "director_id", referencedColumnName = "person_id",insertable = false, updatable = false)
|
---|
| 45 | private Person personsByDirectorId;
|
---|
[6e7b472] | 46 |
|
---|
[2d57cad] | 47 | public int getMovieId() {
|
---|
| 48 | return movieId;
|
---|
| 49 | }
|
---|
[6e7b472] | 50 |
|
---|
[2d57cad] | 51 | public void setMovieId(int movieId) {
|
---|
| 52 | this.movieId = movieId;
|
---|
| 53 | }
|
---|
[6e7b472] | 54 |
|
---|
[2d57cad] | 55 | public String getTitle() {
|
---|
| 56 | return title;
|
---|
| 57 | }
|
---|
[6e7b472] | 58 |
|
---|
[2d57cad] | 59 | public void setTitle(String title) {
|
---|
| 60 | this.title = title;
|
---|
| 61 | }
|
---|
[6e7b472] | 62 |
|
---|
[2d57cad] | 63 | public String getDescription() {
|
---|
| 64 | return description;
|
---|
| 65 | }
|
---|
[6e7b472] | 66 |
|
---|
[2d57cad] | 67 | public void setDescription(String description) {
|
---|
| 68 | this.description = description;
|
---|
| 69 | }
|
---|
[6e7b472] | 70 |
|
---|
[2d57cad] | 71 | public String getImageUrl() {
|
---|
| 72 | return imageUrl;
|
---|
| 73 | }
|
---|
[6e7b472] | 74 |
|
---|
[2d57cad] | 75 | public void setImageUrl(String imageUrl) {
|
---|
| 76 | this.imageUrl = imageUrl;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | public Date getAiringDate() {
|
---|
| 80 | return airingDate;
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | public void setAiringDate(Date airingDate) {
|
---|
| 84 | this.airingDate = airingDate;
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | public Double getImdbRating() {
|
---|
| 88 | return imdbRating;
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | public void setImdbRating(Double imdbRating) {
|
---|
| 92 | this.imdbRating = imdbRating;
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | public Integer getDirectorId() {
|
---|
| 96 | return directorId;
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | public void setDirectorId(Integer directorId) {
|
---|
| 100 | this.directorId = directorId;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | @Override
|
---|
| 104 | public boolean equals(Object o) {
|
---|
| 105 | if (this == o) return true;
|
---|
| 106 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 107 |
|
---|
| 108 | Movie that = (Movie) o;
|
---|
| 109 |
|
---|
| 110 | if (movieId != that.movieId) return false;
|
---|
| 111 | if (!Objects.equals(title, that.title)) return false;
|
---|
| 112 | if (!Objects.equals(description, that.description)) return false;
|
---|
| 113 | if (!Objects.equals(imageUrl, that.imageUrl)) return false;
|
---|
| 114 | if (!Objects.equals(airingDate, that.airingDate)) return false;
|
---|
| 115 | if (!Objects.equals(imdbRating, that.imdbRating)) return false;
|
---|
| 116 | if (!Objects.equals(directorId, that.directorId)) return false;
|
---|
| 117 |
|
---|
| 118 | return true;
|
---|
| 119 | }
|
---|
[6e7b472] | 120 |
|
---|
[2d57cad] | 121 | public Movie(String title, String description, String imageUrl, Date airingDate, Double imdbRating, Integer directorId) {
|
---|
| 122 | this.title = title;
|
---|
| 123 | this.description = description;
|
---|
| 124 | this.imageUrl = imageUrl;
|
---|
| 125 | this.airingDate = airingDate;
|
---|
| 126 | this.imdbRating = imdbRating;
|
---|
| 127 | this.directorId = directorId;
|
---|
| 128 | }
|
---|
[6e7b472] | 129 |
|
---|
[2d57cad] | 130 | public Movie() {
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | @Override
|
---|
| 134 | public int hashCode() {
|
---|
| 135 | int result = movieId;
|
---|
| 136 | result = 31 * result + (title != null ? title.hashCode() : 0);
|
---|
| 137 | result = 31 * result + (description != null ? description.hashCode() : 0);
|
---|
| 138 | result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
|
---|
| 139 | result = 31 * result + (airingDate != null ? airingDate.hashCode() : 0);
|
---|
| 140 | result = 31 * result + (imdbRating != null ? imdbRating.hashCode() : 0);
|
---|
| 141 | result = 31 * result + (directorId != null ? directorId.hashCode() : 0);
|
---|
| 142 | return result;
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | public Collection<Discussion> getDiscussionsByMovieId() {
|
---|
| 146 | return discussionsByMovieId;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | public void setDiscussionsByMovieId(Collection<Discussion> discussionsByMovieId) {
|
---|
| 150 | this.discussionsByMovieId = discussionsByMovieId;
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | public Collection<MovieActorsEntity> getMovieActorsByMovieId() {
|
---|
| 154 | return movieActorsByMovieId;
|
---|
| 155 | }
|
---|
| 156 |
|
---|
| 157 | public void setMovieActorsByMovieId(Collection<MovieActorsEntity> movieActorsByMovieId) {
|
---|
| 158 | this.movieActorsByMovieId = movieActorsByMovieId;
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | public Collection<MovieGenresEntity> getMovieGenresByMovieId() {
|
---|
| 162 | return movieGenresByMovieId;
|
---|
| 163 | }
|
---|
| 164 |
|
---|
| 165 | public void setMovieGenresByMovieId(Collection<MovieGenresEntity> movieGenresByMovieId) {
|
---|
| 166 | this.movieGenresByMovieId = movieGenresByMovieId;
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | public Collection<MovieLikesEntity> getMovieLikesByMovieId() {
|
---|
| 170 | return movieLikesByMovieId;
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | public void setMovieLikesByMovieId(Collection<MovieLikesEntity> movieLikesByMovieId) {
|
---|
| 174 | this.movieLikesByMovieId = movieLikesByMovieId;
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | public Collection<MovieRatesEntity> getMovieRatesByMovieId() {
|
---|
| 178 | return movieRatesByMovieId;
|
---|
| 179 | }
|
---|
| 180 |
|
---|
| 181 | public void setMovieRatesByMovieId(Collection<MovieRatesEntity> movieRatesByMovieId) {
|
---|
| 182 | this.movieRatesByMovieId = movieRatesByMovieId;
|
---|
| 183 | }
|
---|
| 184 |
|
---|
| 185 | public Person getPersonsByDirectorId() {
|
---|
| 186 | return personsByDirectorId;
|
---|
| 187 | }
|
---|
| 188 |
|
---|
| 189 | public void setPersonsByDirectorId(Person personsByDirectorId) {
|
---|
| 190 | this.personsByDirectorId = personsByDirectorId;
|
---|
| 191 | }
|
---|
| 192 | }
|
---|