Matthias Andreas Benkard | 2f0b370 | 2020-01-12 15:46:34 +0100 | [diff] [blame^] | 1 | package eu.mulk.entity; |
| 2 | |
| 3 | import io.quarkus.hibernate.orm.panache.PanacheEntityBase; |
| 4 | import java.util.Objects; |
| 5 | import javax.persistence.Basic; |
| 6 | import javax.persistence.Column; |
| 7 | import javax.persistence.Entity; |
| 8 | import javax.persistence.Id; |
| 9 | import javax.persistence.IdClass; |
| 10 | import javax.persistence.JoinColumn; |
| 11 | import javax.persistence.ManyToOne; |
| 12 | import javax.persistence.Table; |
| 13 | |
| 14 | @Entity |
| 15 | @Table(name = "article_revision_characteristics", schema = "public", catalog = "mulkcms") |
| 16 | @IdClass(ArticleRevisionCharacteristicPK.class) |
| 17 | public class ArticleRevisionCharacteristic extends PanacheEntityBase { |
| 18 | |
| 19 | private String characteristic; |
| 20 | private int articleRevisionId; |
| 21 | |
| 22 | private ArticleRevision articleRevision; |
| 23 | private String value; |
| 24 | |
| 25 | @Basic |
| 26 | @Column(name = "characteristic", nullable = false, length = -1) |
| 27 | @Id |
| 28 | public String getCharacteristic() { |
| 29 | return characteristic; |
| 30 | } |
| 31 | |
| 32 | public void setCharacteristic(String characteristic) { |
| 33 | this.characteristic = characteristic; |
| 34 | } |
| 35 | |
| 36 | @Basic |
| 37 | @Column(name = "value", nullable = true, length = -1) |
| 38 | public String getValue() { |
| 39 | return value; |
| 40 | } |
| 41 | |
| 42 | public void setValue(String value) { |
| 43 | this.value = value; |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | public boolean equals(Object o) { |
| 48 | if (this == o) { |
| 49 | return true; |
| 50 | } |
| 51 | if (o == null || getClass() != o.getClass()) { |
| 52 | return false; |
| 53 | } |
| 54 | ArticleRevisionCharacteristic that = (ArticleRevisionCharacteristic) o; |
| 55 | return Objects.equals(characteristic, that.characteristic) && |
| 56 | Objects.equals(value, that.value); |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public int hashCode() { |
| 61 | return Objects.hash(characteristic, value); |
| 62 | } |
| 63 | |
| 64 | @ManyToOne |
| 65 | @JoinColumn(name = "revision", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) |
| 66 | public ArticleRevision getArticleRevision() { |
| 67 | return articleRevision; |
| 68 | } |
| 69 | |
| 70 | public void setArticleRevision(ArticleRevision articleRevision) { |
| 71 | this.articleRevision = articleRevision; |
| 72 | } |
| 73 | |
| 74 | @Id |
| 75 | @Column(name = "revision", nullable = false) |
| 76 | public int getArticleRevisionId() { |
| 77 | return articleRevisionId; |
| 78 | } |
| 79 | |
| 80 | public void setArticleRevisionId(int articleRevisionId) { |
| 81 | this.articleRevisionId = articleRevisionId; |
| 82 | } |
| 83 | } |