source: Git/src/main/java/com/wediscussmovies/project/model/Discussion.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: 1.8 KB
Line 
1package com.wediscussmovies.project.model;
2
3import lombok.Data;
4
5import javax.persistence.*;
6import java.sql.Date;
7import java.util.Objects;
8
9@Entity
10@Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
11@Data
12public 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}
Note: See TracBrowser for help on using the repository browser.