Changeset 7fafead in Git for src/main/java/com/wediscussmovies/project/model/Discussion.java
- Timestamp:
- 01/16/22 20:22:55 (3 years ago)
- Branches:
- main
- Children:
- 3ded84d
- Parents:
- 2d57cad (diff), 7bc8942 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/wediscussmovies/project/model/Discussion.java
r2d57cad r7fafead 1 1 package com.wediscussmovies.project.model; 2 3 import com.wediscussmovies.project.model.enumerations.DiscussionType; 4 import lombok.Data; 2 5 3 6 import javax.persistence.*; 4 7 import java.sql.Date; 5 8 import java.util.Collection; 9 import java.util.List; 6 10 import java.util.Objects; 7 11 12 @Data 8 13 @Entity 9 14 @Table(name = "discussions", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 10 15 public class Discussion { 16 11 17 @GeneratedValue(strategy = GenerationType.IDENTITY) 12 18 @Id 13 19 @Column(name = "discussion_id") 14 private int discussionId; 15 @Basic 16 @Column(name = "type") 17 private String type; 18 @Basic 19 @Column(name = "text") 20 private Long id; 21 22 @Enumerated 23 private DiscussionType type; 24 20 25 private String text; 21 @Basic 22 @Column(name = "title") 26 23 27 private String title; 24 @Basic 25 @Column(name = "date") 28 26 29 private Date date; 27 @Basic 28 @Column(name = "user_id") 29 private int userId; 30 @Basic 31 @Column(name = "movie_id") 32 private Integer movieId; 33 @Basic 34 @Column(name = "person_id") 35 private Integer personId; 30 31 32 33 36 34 37 35 @ManyToOne 38 @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false) 39 private User usersByUserId; 36 @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false) 37 private User user; 38 40 39 @ManyToOne 41 @JoinColumn(name = "movie_id", referencedColumnName = "movie_id",insertable = false, updatable = false) 42 private Movie moviesByMovieId; 40 @JoinColumn(name = "movie_id", referencedColumnName = "movie_id") 41 private Movie movie; 42 43 43 @ManyToOne 44 @JoinColumn(name = "person_id", referencedColumnName = "person_id",insertable = false, updatable = false) 45 private Person personsByPersonId; 46 @OneToMany(mappedBy = "discussionsByDiscussionId") 47 private Collection<Reply> repliesByDiscussionId; 44 @JoinColumn(name = "person_id", referencedColumnName = "person_id") 45 private Person person; 48 46 49 public int getDiscussionId() {50 return discussionId;51 }52 47 53 public void setDiscussionId(int discussionId) {54 this.discussionId = discussionId;55 }56 48 57 public String getType() {58 return type;59 }60 49 61 public void setType(String type) { 50 51 52 public Discussion(DiscussionType type, String text, String title, Date date, User user, Movie movie, Person person, List<Reply> replies) { 62 53 this.type = type; 63 }64 65 public String getText() {66 return text;67 }68 69 public void setText(String text) {70 54 this.text = text; 71 }72 73 public String getTitle() {74 return title;75 }76 77 public void setTitle(String title) {78 55 this.title = title; 79 }80 81 public Date getDate() {82 return date;83 }84 85 public void setDate(Date date) {86 56 this.date = date; 87 } 88 89 public int getUserId() { 90 return userId; 91 } 92 93 public void setUserId(int userId) { 94 this.userId = userId; 95 } 96 97 public Integer getMovieId() { 98 return movieId; 99 } 100 101 public void setMovieId(Integer movieId) { 102 this.movieId = movieId; 103 } 104 105 public Integer getPersonId() { 106 return personId; 107 } 108 109 public void setPersonId(Integer personId) { 110 this.personId = personId; 111 } 112 113 @Override 114 public boolean equals(Object o) { 115 if (this == o) return true; 116 if (o == null || getClass() != o.getClass()) return false; 117 118 Discussion that = (Discussion) o; 119 120 if (discussionId != that.discussionId) return false; 121 if (userId != that.userId) return false; 122 if (!Objects.equals(type, that.type)) return false; 123 if (!Objects.equals(text, that.text)) return false; 124 if (!Objects.equals(title, that.title)) return false; 125 if (!Objects.equals(date, that.date)) return false; 126 if (!Objects.equals(movieId, that.movieId)) return false; 127 if (!Objects.equals(personId, that.personId)) return false; 128 129 return true; 130 } 131 132 @Override 133 public int hashCode() { 134 int result = discussionId; 135 result = 31 * result + (type != null ? type.hashCode() : 0); 136 result = 31 * result + (text != null ? text.hashCode() : 0); 137 result = 31 * result + (title != null ? title.hashCode() : 0); 138 result = 31 * result + (date != null ? date.hashCode() : 0); 139 result = 31 * result + userId; 140 result = 31 * result + (movieId != null ? movieId.hashCode() : 0); 141 result = 31 * result + (personId != null ? personId.hashCode() : 0); 142 return result; 143 } 144 145 public User getUsersByUserId() { 146 return usersByUserId; 147 } 148 149 public void setUsersByUserId(User usersByUserId) { 150 this.usersByUserId = usersByUserId; 151 } 152 153 public Movie getMoviesByMovieId() { 154 return moviesByMovieId; 155 } 156 157 public void setMoviesByMovieId(Movie moviesByMovieId) { 158 this.moviesByMovieId = moviesByMovieId; 159 } 160 161 public Person getPersonsByPersonId() { 162 return personsByPersonId; 163 } 164 165 public void setPersonsByPersonId(Person personsByPersonId) { 166 this.personsByPersonId = personsByPersonId; 167 } 168 169 public Collection<Reply> getRepliesByDiscussionId() { 170 return repliesByDiscussionId; 171 } 172 173 public void setRepliesByDiscussionId(Collection<Reply> repliesByDiscussionId) { 174 this.repliesByDiscussionId = repliesByDiscussionId; 57 this.user = user; 58 this.movie = movie; 59 this.person = person; 175 60 } 176 61 … … 178 63 } 179 64 180 public Discussion(String type, String text, String title, Date date, int userId, Integer movieId, Integer personId) { 181 this.type = type; 182 this.text = text; 183 this.title = title; 184 this.date = date; 185 this.userId = userId; 186 this.movieId = movieId; 187 this.personId = personId; 188 } 65 189 66 }
Note:
See TracChangeset
for help on using the changeset viewer.