[6e7b472] | 1 | package com.wediscussmovies.project.model;
|
---|
| 2 |
|
---|
| 3 | import javax.persistence.*;
|
---|
| 4 | import java.sql.Date;
|
---|
[2d57cad] | 5 | import java.util.Collection;
|
---|
[6e7b472] | 6 |
|
---|
[2d57cad] | 7 | @Entity
|
---|
| 8 | @Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
[6e7b472] | 9 | public class Person {
|
---|
[2d57cad] | 10 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
[6e7b472] | 11 | @Id
|
---|
[2d57cad] | 12 | @Column(name = "person_id")
|
---|
| 13 | private int personId;
|
---|
| 14 | @Basic
|
---|
| 15 | @Column(name = "name")
|
---|
[6e7b472] | 16 | private String name;
|
---|
[2d57cad] | 17 | @Basic
|
---|
| 18 | @Column(name = "surname")
|
---|
[6e7b472] | 19 | private String surname;
|
---|
[2d57cad] | 20 | @Basic
|
---|
| 21 | @Column(name = "type")
|
---|
| 22 | private String type;
|
---|
| 23 | @Basic
|
---|
| 24 | @Column(name = "date_of_birth")
|
---|
| 25 | private Date dateOfBirth;
|
---|
| 26 | @Basic
|
---|
| 27 | @Column(name = "image_url")
|
---|
| 28 | private String imageUrl;
|
---|
| 29 | @Basic
|
---|
| 30 | @Column(name = "description")
|
---|
| 31 | private String description;
|
---|
| 32 | @OneToMany(mappedBy = "personsByPersonId")
|
---|
| 33 | private Collection<Discussion> discussionsByPersonId;
|
---|
| 34 | @OneToMany(mappedBy = "personsByActorId")
|
---|
| 35 | private Collection<MovieActorsEntity> movieActorsByPersonId;
|
---|
| 36 | @OneToMany(mappedBy = "personsByDirectorId")
|
---|
| 37 | private Collection<Movie> moviesByPersonId;
|
---|
| 38 | @OneToMany(mappedBy = "personsByPersonId")
|
---|
| 39 | private Collection<PersonRatesEntity> personRatesByPersonId;
|
---|
[6e7b472] | 40 |
|
---|
[2d57cad] | 41 | public int getPersonId() {
|
---|
| 42 | return personId;
|
---|
| 43 | }
|
---|
[6e7b472] | 44 |
|
---|
[2d57cad] | 45 | public void setPersonId(int personId) {
|
---|
| 46 | this.personId = personId;
|
---|
| 47 | }
|
---|
[6e7b472] | 48 |
|
---|
[2d57cad] | 49 | public String getName() {
|
---|
| 50 | return name;
|
---|
| 51 | }
|
---|
[6e7b472] | 52 |
|
---|
[2d57cad] | 53 | public void setName(String name) {
|
---|
| 54 | this.name = name;
|
---|
| 55 | }
|
---|
[6e7b472] | 56 |
|
---|
[2d57cad] | 57 | public String getSurname() {
|
---|
| 58 | return surname;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public void setSurname(String surname) {
|
---|
| 62 | this.surname = surname;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | public String getType() {
|
---|
| 66 | return type;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | public void setType(String type) {
|
---|
| 70 | this.type = type;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | public Date getDateOfBirth() {
|
---|
| 74 | return dateOfBirth;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | public void setDateOfBirth(Date dateOfBirth) {
|
---|
| 78 | this.dateOfBirth = dateOfBirth;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | public String getImageUrl() {
|
---|
| 82 | return imageUrl;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | public void setImageUrl(String imageUrl) {
|
---|
| 86 | this.imageUrl = imageUrl;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | public String getDescription() {
|
---|
| 90 | return description;
|
---|
| 91 | }
|
---|
[6e7b472] | 92 |
|
---|
[2d57cad] | 93 | public void setDescription(String description) {
|
---|
| 94 | this.description = description;
|
---|
| 95 | }
|
---|
[6e7b472] | 96 |
|
---|
[2d57cad] | 97 | @Override
|
---|
| 98 | public boolean equals(Object o) {
|
---|
| 99 | if (this == o) return true;
|
---|
| 100 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 101 |
|
---|
| 102 | Person that = (Person) o;
|
---|
| 103 |
|
---|
| 104 | if (personId != that.personId) return false;
|
---|
| 105 | if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
---|
| 106 | if (surname != null ? !surname.equals(that.surname) : that.surname != null) return false;
|
---|
| 107 | if (type != null ? !type.equals(that.type) : that.type != null) return false;
|
---|
| 108 | if (dateOfBirth != null ? !dateOfBirth.equals(that.dateOfBirth) : that.dateOfBirth != null) return false;
|
---|
| 109 | if (imageUrl != null ? !imageUrl.equals(that.imageUrl) : that.imageUrl != null) return false;
|
---|
| 110 | if (description != null ? !description.equals(that.description) : that.description != null) return false;
|
---|
| 111 |
|
---|
| 112 | return true;
|
---|
| 113 | }
|
---|
| 114 |
|
---|
| 115 | @Override
|
---|
| 116 | public int hashCode() {
|
---|
| 117 | int result = personId;
|
---|
| 118 | result = 31 * result + (name != null ? name.hashCode() : 0);
|
---|
| 119 | result = 31 * result + (surname != null ? surname.hashCode() : 0);
|
---|
| 120 | result = 31 * result + (type != null ? type.hashCode() : 0);
|
---|
| 121 | result = 31 * result + (dateOfBirth != null ? dateOfBirth.hashCode() : 0);
|
---|
| 122 | result = 31 * result + (imageUrl != null ? imageUrl.hashCode() : 0);
|
---|
| 123 | result = 31 * result + (description != null ? description.hashCode() : 0);
|
---|
| 124 | return result;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | public Collection<Discussion> getDiscussionsByPersonId() {
|
---|
| 128 | return discussionsByPersonId;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | public void setDiscussionsByPersonId(Collection<Discussion> discussionsByPersonId) {
|
---|
| 132 | this.discussionsByPersonId = discussionsByPersonId;
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | public Collection<MovieActorsEntity> getMovieActorsByPersonId() {
|
---|
| 136 | return movieActorsByPersonId;
|
---|
| 137 | }
|
---|
| 138 |
|
---|
| 139 | public void setMovieActorsByPersonId(Collection<MovieActorsEntity> movieActorsByPersonId) {
|
---|
| 140 | this.movieActorsByPersonId = movieActorsByPersonId;
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | public Collection<Movie> getMoviesByPersonId() {
|
---|
| 144 | return moviesByPersonId;
|
---|
| 145 | }
|
---|
| 146 |
|
---|
| 147 | public void setMoviesByPersonId(Collection<Movie> moviesByPersonId) {
|
---|
| 148 | this.moviesByPersonId = moviesByPersonId;
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | public Collection<PersonRatesEntity> getPersonRatesByPersonId() {
|
---|
| 152 | return personRatesByPersonId;
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | public void setPersonRatesByPersonId(Collection<PersonRatesEntity> personRatesByPersonId) {
|
---|
| 156 | this.personRatesByPersonId = personRatesByPersonId;
|
---|
| 157 | }
|
---|
| 158 | }
|
---|