Ignore:
Timestamp:
01/16/22 20:22:55 (3 years ago)
Author:
Test <matonikolov77@…>
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.
Message:

Resolving models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/wediscussmovies/project/model/Reply.java

    r2d57cad r7fafead  
    11package com.wediscussmovies.project.model;
     2
     3import lombok.Data;
    24
    35import javax.persistence.*;
    46import java.sql.Date;
     7import java.util.Optional;
    58
    69@Entity
    710@Table(name = "replies", schema = "project", catalog = "db_202122z_va_prj_wediscussmovies")
    811@IdClass(RepliesEntityPK.class)
     12@Data
    913public class Reply {
    1014    @Id
    11     @Column(name = "discussion_id",insertable = false, updatable = false)
    12     private int discussionId;
     15    @Column(name = "discussion_id")
     16    private Long discussionId;
     17
    1318    @GeneratedValue(strategy = GenerationType.IDENTITY)
    1419    @Id
    1520    @Column(name = "reply_id")
    16     private int replyId;
    17     @Basic
    18     @Column(name = "text")
     21    private Long replyId;
     22
    1923    private String text;
    20     @Basic
    21     @Column(name = "date")
     24
    2225    private Date date;
    23     @Basic
    24     @Column(name = "user_id")
    25     private int userId;
     26
    2627    @ManyToOne
    2728    @JoinColumn(name = "discussion_id", referencedColumnName = "discussion_id", nullable = false,insertable = false, updatable = false)
    28     private Discussion discussionsByDiscussionId;
     29    private Discussion discussion;
     30
    2931    @ManyToOne
    30     @JoinColumn(name = "user_id", referencedColumnName = "user_id", nullable = false,insertable = false, updatable = false)
    31     private User usersByUserId;
     32    @JoinColumn(name = "user_id")
     33    private User user;
    3234
    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
    3544    }
    3645
    37     public void setDiscussionId(int discussionId) {
    38         this.discussionId = discussionId;
     46    public Reply() {
     47
    3948    }
    4049
    41     public int getReplyId() {
    42         return replyId;
    43     }
    4450
    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     @Override
    74     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     @Override
    90     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     }
    11451}
Note: See TracChangeset for help on using the changeset viewer.