Changeset 7fafead in Git for src/main/java/com/wediscussmovies/project/model/Reply.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/Reply.java
r2d57cad r7fafead 1 1 package com.wediscussmovies.project.model; 2 3 import lombok.Data; 2 4 3 5 import javax.persistence.*; 4 6 import java.sql.Date; 7 import java.util.Optional; 5 8 6 9 @Entity 7 10 @Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies") 8 11 @IdClass(RepliesEntityPK.class) 12 @Data 9 13 public class Reply { 10 14 @Id 11 @Column(name = "discussion_id",insertable = false, updatable = false) 12 private int discussionId; 15 @Column(name = "discussion_id") 16 private Long discussionId; 17 13 18 @GeneratedValue(strategy = GenerationType.IDENTITY) 14 19 @Id 15 20 @Column(name = "reply_id") 16 private int replyId; 17 @Basic 18 @Column(name = "text") 21 private Long replyId; 22 19 23 private String text; 20 @Basic 21 @Column(name = "date") 24 22 25 private Date date; 23 @Basic 24 @Column(name = "user_id") 25 private int userId; 26 26 27 @ManyToOne 27 28 @JoinColumn(name = "discussion_id", referencedColumnName = "discussion_id", nullable = false,insertable = false, updatable = false) 28 private Discussion discussionsByDiscussionId; 29 private Discussion discussion; 30 29 31 @ManyToOne 30 @JoinColumn(name = "user_id" , referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)31 private User user sByUserId;32 @JoinColumn(name = "user_id") 33 private User user; 32 34 33 public int getDiscussionId() { 34 return discussionId; 35 36 37 38 public Reply(Discussion discussion, User user, Date date, String text) { 39 this.discussion = discussion; 40 this.user = user; 41 this.date = date; 42 this.text = text; 43 35 44 } 36 45 37 public void setDiscussionId(int discussionId) {38 this.discussionId = discussionId; 46 public Reply() { 47 39 48 } 40 49 41 public int getReplyId() {42 return replyId;43 }44 50 45 public void setReplyId(int replyId) {46 this.replyId = replyId;47 }48 49 public String getText() {50 return text;51 }52 53 public void setText(String text) {54 this.text = text;55 }56 57 public Date getDate() {58 return date;59 }60 61 public void setDate(Date date) {62 this.date = date;63 }64 65 public int getUserId() {66 return userId;67 }68 69 public void setUserId(int userId) {70 this.userId = userId;71 }72 73 @Override74 public boolean equals(Object o) {75 if (this == o) return true;76 if (o == null || getClass() != o.getClass()) return false;77 78 Reply that = (Reply) o;79 80 if (discussionId != that.discussionId) return false;81 if (replyId != that.replyId) return false;82 if (userId != that.userId) return false;83 if (text != null ? !text.equals(that.text) : that.text != null) return false;84 if (date != null ? !date.equals(that.date) : that.date != null) return false;85 86 return true;87 }88 89 @Override90 public int hashCode() {91 int result = discussionId;92 result = 31 * result + replyId;93 result = 31 * result + (text != null ? text.hashCode() : 0);94 result = 31 * result + (date != null ? date.hashCode() : 0);95 result = 31 * result + userId;96 return result;97 }98 99 public Discussion getDiscussionsByDiscussionId() {100 return discussionsByDiscussionId;101 }102 103 public void setDiscussionsByDiscussionId(Discussion discussionsByDiscussionId) {104 this.discussionsByDiscussionId = discussionsByDiscussionId;105 }106 107 public User getUsersByUserId() {108 return usersByUserId;109 }110 111 public void setUsersByUserId(User usersByUserId) {112 this.usersByUserId = usersByUserId;113 }114 51 }
Note:
See TracChangeset
for help on using the changeset viewer.