main
Last change
on this file was 980eeda, checked in by Test <matonikolov77@…>, 2 years ago |
Restructuring project
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | package com.wediscussmovies.project.model.primarykeys;
|
---|
2 |
|
---|
3 | import lombok.Data;
|
---|
4 |
|
---|
5 | import javax.persistence.*;
|
---|
6 | import java.io.Serializable;
|
---|
7 | import java.util.Objects;
|
---|
8 |
|
---|
9 | @Data
|
---|
10 | public 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.