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.Column; |
| 6 | import javax.persistence.Entity; |
| 7 | import javax.persistence.Id; |
| 8 | import javax.persistence.JoinColumn; |
| 9 | import javax.persistence.ManyToOne; |
| 10 | import javax.persistence.Table; |
| 11 | |
| 12 | @Entity |
| 13 | @Table(name = "article_aliases", schema = "public", catalog = "mulkcms") |
| 14 | public class ArticleAlias extends PanacheEntityBase { |
| 15 | |
| 16 | private String alias; |
| 17 | private Article article; |
| 18 | |
| 19 | @Id |
| 20 | @Column(name = "alias", nullable = false, length = -1) |
| 21 | public String getAlias() { |
| 22 | return alias; |
| 23 | } |
| 24 | |
| 25 | public void setAlias(String alias) { |
| 26 | this.alias = alias; |
| 27 | } |
| 28 | |
| 29 | @Override |
| 30 | public boolean equals(Object o) { |
| 31 | if (this == o) { |
| 32 | return true; |
| 33 | } |
| 34 | if (o == null || getClass() != o.getClass()) { |
| 35 | return false; |
| 36 | } |
| 37 | ArticleAlias that = (ArticleAlias) o; |
| 38 | return Objects.equals(alias, that.alias); |
| 39 | } |
| 40 | |
| 41 | @Override |
| 42 | public int hashCode() { |
| 43 | return Objects.hash(alias); |
| 44 | } |
| 45 | |
| 46 | @ManyToOne |
| 47 | @JoinColumn(name = "article", referencedColumnName = "id", nullable = false) |
| 48 | public Article getArticle() { |
| 49 | return article; |
| 50 | } |
| 51 | |
| 52 | public void setArticle(Article article) { |
| 53 | this.article = article; |
| 54 | } |
| 55 | } |