Matthias Andreas Benkard | 2f0b370 | 2020-01-12 15:46:34 +0100 | [diff] [blame^] | 1 | package eu.mulk.entity; |
| 2 | |
| 3 | import java.io.Serializable; |
| 4 | import java.util.Objects; |
| 5 | import javax.persistence.Column; |
| 6 | import javax.persistence.Id; |
| 7 | |
| 8 | public class ArticleRevisionParenthoodPK implements Serializable { |
| 9 | |
| 10 | private int parentId; |
| 11 | private int childId; |
| 12 | |
| 13 | @Column(name = "parent", nullable = false) |
| 14 | @Id |
| 15 | public int getParentId() { |
| 16 | return parentId; |
| 17 | } |
| 18 | |
| 19 | public void setParentId(int parentId) { |
| 20 | this.parentId = parentId; |
| 21 | } |
| 22 | |
| 23 | @Column(name = "child", nullable = false) |
| 24 | @Id |
| 25 | public int getChildId() { |
| 26 | return childId; |
| 27 | } |
| 28 | |
| 29 | public void setChildId(int childId) { |
| 30 | this.childId = childId; |
| 31 | } |
| 32 | |
| 33 | @Override |
| 34 | public boolean equals(Object o) { |
| 35 | if (this == o) { |
| 36 | return true; |
| 37 | } |
| 38 | if (o == null || getClass() != o.getClass()) { |
| 39 | return false; |
| 40 | } |
| 41 | ArticleRevisionParenthoodPK that = (ArticleRevisionParenthoodPK) o; |
| 42 | return parentId == that.parentId && |
| 43 | childId == that.childId; |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | public int hashCode() { |
| 48 | return Objects.hash(parentId, childId); |
| 49 | } |
| 50 | } |