source: Git/Sources/src/main/java/com/wediscussmovies/project/model/Discussion.java@ 980eeda

main
Last change on this file since 980eeda was 980eeda, checked in by Test <matonikolov77@…>, 22 months ago

Restructuring project

  • Property mode set to 100644
File size: 1.6 KB
Line 
1package com.wediscussmovies.project.model;
2
3import lombok.AllArgsConstructor;
4import lombok.Data;
5import org.springframework.beans.factory.annotation.Value;
6
7import javax.persistence.*;
8import java.time.LocalDate;
9import java.util.Objects;
10
11@Entity
12@Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
13@Data
14public class Discussion {
15 @GeneratedValue(strategy = GenerationType.IDENTITY)
16 @Id
17 @Column(name = "discussion_id")
18 private int discussionId;
19 @Basic
20 @Column(name = "type")
21 private Character type;
22 @Basic
23 @Column(name = "text")
24 private String text;
25 @Basic
26 @Column(name = "title")
27 private String title;
28 @Basic
29 @Column(name = "date")
30 private LocalDate date;
31
32
33
34
35
36 @ManyToOne
37 @JoinColumn(name = "movie_id")
38 private Movie movie;
39
40 @ManyToOne
41 @JoinColumn(name = "user_id")
42 private User user;
43
44 @ManyToOne
45 @JoinColumn(name = "person_id")
46 private Person person;
47
48 @Transient
49 private long likes;
50
51 public Discussion(Character type, String text, String title, LocalDate date, User user) {
52 this.type = type;
53 this.text = text;
54 this.title = title;
55 this.date = date;
56 this.user = user;
57 }
58
59
60
61 public Discussion() {
62 }
63
64
65 @Override
66 public boolean equals(Object o) {
67 if (this == o) return true;
68 if (o == null || getClass() != o.getClass()) return false;
69 Discussion that = (Discussion) o;
70 return discussionId == that.discussionId;
71 }
72
73 @Override
74 public int hashCode() {
75 return Objects.hash(discussionId);
76 }
77}
Note: See TracBrowser for help on using the repository browser.