source: Git/src/main/java/com/wediscussmovies/project/model/primarykeys/ReplyPK.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.0 KB
Line 
1package com.wediscussmovies.project.model.primarykeys;
2
3import lombok.Data;
4
5import javax.persistence.*;
6import java.io.Serializable;
7import java.util.Objects;
8
9@Data
10public class ReplyPK implements Serializable {
11
12 @Column(name = "discussion_id")
13 private int discussionId;
14
15 @Column(name = "reply_id")
16 @GeneratedValue(strategy = GenerationType.IDENTITY)
17 private int replyId;
18
19 public ReplyPK(int discussionId) {
20 this.discussionId = discussionId;
21 }
22
23 public ReplyPK(int discussionId, int replyId) {
24 this.discussionId = discussionId;
25 this.replyId = replyId;
26 }
27
28 public ReplyPK() {
29 }
30
31 @Override
32 public boolean equals(Object o) {
33 if (this == o) return true;
34 if (o == null || getClass() != o.getClass()) return false;
35 ReplyPK replyPK = (ReplyPK) o;
36 return discussionId == replyPK.discussionId && replyId == replyPK.replyId;
37 }
38
39 @Override
40 public int hashCode() {
41 return Objects.hash(discussionId, replyId);
42 }
43
44
45}
Note: See TracBrowser for help on using the repository browser.