main
Last change
on this file since c02189f was c02189f, checked in by Petar Partaloski <ppartaloski@…>, 2 years ago |
Added new core functionalities, fixed bugs and improved visual clarity
|
-
Property mode
set to
100644
|
File size:
975 bytes
|
Rev | Line | |
---|
[c02189f] | 1 | package com.wediscussmovies.project.model.primarykeys;
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 | import lombok.Data;
|
---|
| 5 |
|
---|
| 6 | import javax.persistence.Column;
|
---|
| 7 | import javax.persistence.Embeddable;
|
---|
| 8 | import java.io.Serializable;
|
---|
| 9 | import java.util.Objects;
|
---|
| 10 |
|
---|
| 11 | @Embeddable
|
---|
| 12 | @Data
|
---|
| 13 | public class DiscussionLikesPK implements Serializable {
|
---|
| 14 | @Column(name = "discussion_id")
|
---|
| 15 | private int discussionId;
|
---|
| 16 |
|
---|
| 17 | @Column(name = "user_id")
|
---|
| 18 | private int userId;
|
---|
| 19 |
|
---|
| 20 | public DiscussionLikesPK(int discussionId, int userId) {
|
---|
| 21 | this.discussionId = discussionId;
|
---|
| 22 | this.userId = userId;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | public DiscussionLikesPK() {
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | @Override
|
---|
| 29 | public boolean equals(Object o) {
|
---|
| 30 | if (this == o) return true;
|
---|
| 31 | if (o == null || getClass() != o.getClass()) return false;
|
---|
| 32 | DiscussionLikesPK that = (DiscussionLikesPK) o;
|
---|
| 33 | return discussionId == that.discussionId && userId == that.userId;
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | @Override
|
---|
| 37 | public int hashCode() {
|
---|
| 38 | return Objects.hash(discussionId, userId);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.