[5b447b0] | 1 | package com.wediscussmovies.project.model;
|
---|
| 2 |
|
---|
| 3 | import com.wediscussmovies.project.model.relation.MovieActors;
|
---|
| 4 | import com.wediscussmovies.project.model.relation.PersonRates;
|
---|
| 5 | import lombok.Data;
|
---|
| 6 |
|
---|
| 7 | import javax.persistence.*;
|
---|
| 8 | import java.sql.Date;
|
---|
| 9 | import java.util.Collection;
|
---|
| 10 |
|
---|
| 11 | @Entity
|
---|
| 12 | @Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
| 13 | @Data
|
---|
| 14 | public class Person {
|
---|
| 15 |
|
---|
| 16 | /*
|
---|
| 17 | ni fale tabela za person koj zanrovi gi ima - ako e potrebno
|
---|
| 18 | */
|
---|
| 19 |
|
---|
| 20 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 21 | @Id
|
---|
| 22 | @Column(name = "person_id")
|
---|
| 23 | private int personId;
|
---|
| 24 | @Basic
|
---|
| 25 | @Column(name = "name")
|
---|
| 26 | private String name;
|
---|
| 27 | @Basic
|
---|
| 28 | @Column(name = "surname")
|
---|
| 29 | private String surname;
|
---|
| 30 | @Basic
|
---|
| 31 | @Column(name = "type")
|
---|
| 32 | private Character type;
|
---|
| 33 | @Basic
|
---|
| 34 | @Column(name = "date_of_birth")
|
---|
| 35 | private Date dateOfBirth;
|
---|
| 36 | @Basic
|
---|
| 37 | @Column(name = "image_url")
|
---|
| 38 | private String imageUrl;
|
---|
| 39 | @Basic
|
---|
| 40 | @Column(name = "description")
|
---|
| 41 | private String description;
|
---|
| 42 | @OneToMany(mappedBy = "person")
|
---|
| 43 | private Collection<Discussion> discussions;
|
---|
| 44 | @OneToMany(mappedBy = "person")
|
---|
| 45 | private Collection<MovieActors> movieActors;
|
---|
| 46 | @OneToMany(mappedBy = "director")
|
---|
| 47 | private Collection<Movie> movies;
|
---|
| 48 | @OneToMany(mappedBy = "person")
|
---|
| 49 | private Collection<PersonRates> personRates;
|
---|
| 50 |
|
---|
| 51 |
|
---|
| 52 |
|
---|
| 53 | public Person() {
|
---|
| 54 |
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | @Override
|
---|
| 59 | public boolean equals(Object o) {
|
---|
| 60 | if (this == o) return true;
|
---|
| 61 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 62 |
|
---|
| 63 | Person that = (Person) o;
|
---|
| 64 |
|
---|
| 65 | return personId == that.getPersonId();
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | @Override
|
---|
| 69 | public int hashCode() {
|
---|
| 70 |
|
---|
| 71 | return personId * 31;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | public Person(String name, String surname, Character type, Date dateOfBirth, String imageUrl, String description) {
|
---|
| 77 | this.name = name;
|
---|
| 78 | this.surname = surname;
|
---|
| 79 | this.type = type;
|
---|
| 80 | this.dateOfBirth = dateOfBirth;
|
---|
| 81 | this.imageUrl = imageUrl;
|
---|
| 82 | this.description = description;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | }
|
---|