1 | package com.wediscussmovies.project.model;
|
---|
2 |
|
---|
3 | import lombok.Data;
|
---|
4 |
|
---|
5 | import javax.persistence.*;
|
---|
6 | import java.sql.Date;
|
---|
7 | import java.util.Objects;
|
---|
8 |
|
---|
9 | @Entity
|
---|
10 | @Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
|
---|
11 | @Data
|
---|
12 | public class Discussion {
|
---|
13 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
14 | @Id
|
---|
15 | @Column(name = "discussion_id")
|
---|
16 | private int discussionId;
|
---|
17 | @Basic
|
---|
18 | @Column(name = "type")
|
---|
19 | private Character type;
|
---|
20 | @Basic
|
---|
21 | @Column(name = "text")
|
---|
22 | private String text;
|
---|
23 | @Basic
|
---|
24 | @Column(name = "title")
|
---|
25 | private String title;
|
---|
26 | @Basic
|
---|
27 | @Column(name = "date")
|
---|
28 | private Date date;
|
---|
29 |
|
---|
30 |
|
---|
31 | @ManyToOne
|
---|
32 | @JoinColumn(name = "movie_id")
|
---|
33 | private Movie movie;
|
---|
34 |
|
---|
35 | @ManyToOne
|
---|
36 | @JoinColumn(name = "user_id")
|
---|
37 | private User user;
|
---|
38 |
|
---|
39 | @ManyToOne
|
---|
40 | @JoinColumn(name = "person_id")
|
---|
41 | private Person person;
|
---|
42 |
|
---|
43 | public Discussion(Character type, String text, String title, Date date, User user) {
|
---|
44 | this.type = type;
|
---|
45 | this.text = text;
|
---|
46 | this.title = title;
|
---|
47 | this.date = date;
|
---|
48 | this.user = user;
|
---|
49 | }
|
---|
50 |
|
---|
51 | public Discussion() {
|
---|
52 | }
|
---|
53 |
|
---|
54 | public String getText() {
|
---|
55 | return text;
|
---|
56 | }
|
---|
57 |
|
---|
58 | public void setText(String text) {
|
---|
59 | this.text = text;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public String getTitle() {
|
---|
63 | return title;
|
---|
64 | }
|
---|
65 |
|
---|
66 | public void setTitle(String title) {
|
---|
67 | this.title = title;
|
---|
68 | }
|
---|
69 |
|
---|
70 | public Date getDate() {
|
---|
71 | return date;
|
---|
72 | }
|
---|
73 |
|
---|
74 | public void setDate(Date date) {
|
---|
75 | this.date = date;
|
---|
76 | }
|
---|
77 |
|
---|
78 | @Override
|
---|
79 | public boolean equals(Object o) {
|
---|
80 | if (this == o) return true;
|
---|
81 | if (o == null || getClass() != o.getClass()) return false;
|
---|
82 | Discussion that = (Discussion) o;
|
---|
83 | return discussionId == that.discussionId;
|
---|
84 | }
|
---|
85 |
|
---|
86 | @Override
|
---|
87 | public int hashCode() {
|
---|
88 | return Objects.hash(discussionId);
|
---|
89 | }
|
---|
90 | }
|
---|