blob: 823ca09c164285966e568cc0b4ca38f3acac0628 [file] [log] [blame]
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +01001package eu.mulk.entity;
2
3import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
4import java.util.Objects;
5import javax.persistence.Column;
6import javax.persistence.Entity;
7import javax.persistence.Id;
8import javax.persistence.IdClass;
9import javax.persistence.JoinColumn;
10import javax.persistence.ManyToOne;
11import javax.persistence.Table;
12
13@Entity
14@Table(name = "article_revision_parenthood", schema = "public", catalog = "mulkcms")
15@IdClass(ArticleRevisionParenthoodPK.class)
16public class ArticleRevisionParenthood extends PanacheEntityBase {
17
18 private int parentId;
19 private int childId;
20 private ArticleRevision parent;
21 private ArticleRevision child;
22
23 @Id
24 @Column(name = "parent", nullable = false)
25 public int getParentId() {
26 return parentId;
27 }
28
29 public void setParentId(int parentId) {
30 this.parentId = parentId;
31 }
32
33 @Id
34 @Column(name = "child", nullable = false)
35 public int getChildId() {
36 return childId;
37 }
38
39 public void setChildId(int childId) {
40 this.childId = childId;
41 }
42
43 @Override
44 public boolean equals(Object o) {
45 if (this == o) {
46 return true;
47 }
48 if (o == null || getClass() != o.getClass()) {
49 return false;
50 }
51 ArticleRevisionParenthood that = (ArticleRevisionParenthood) o;
52 return parentId == that.parentId &&
53 childId == that.childId;
54 }
55
56 @Override
57 public int hashCode() {
58 return Objects.hash(parentId, childId);
59 }
60
61 @ManyToOne
62 @JoinColumn(name = "parent", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
63 public ArticleRevision getParent() {
64 return parent;
65 }
66
67 public void setParent(ArticleRevision parent) {
68 this.parent = parent;
69 }
70
71 @ManyToOne
72 @JoinColumn(name = "child", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
73 public ArticleRevision getChild() {
74 return child;
75 }
76
77 public void setChild(ArticleRevision child) {
78 this.child = child;
79 }
80}