source: Git/src/main/java/com/wediscussmovies/project/model/Person.java@ 5b447b0

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: 2.0 KB
Line 
1package com.wediscussmovies.project.model;
2
3import com.wediscussmovies.project.model.relation.MovieActors;
4import com.wediscussmovies.project.model.relation.PersonRates;
5import lombok.Data;
6
7import javax.persistence.*;
8import java.sql.Date;
9import java.util.Collection;
10
11@Entity
12@Table(name = "persons", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
13@Data
14public 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}
Note: See TracBrowser for help on using the repository browser.