diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 16:07:43 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 16:07:43 +0100 |
commit | 5cd91aba8342c9ab0d76a6fe35d33039eec8165f (patch) | |
tree | a9d4e4e73a3e870ad872c10c439d0e0083f39c09 /src/main/scala/eu/mulk/entity/CategoryInclusion.java | |
parent | 2f0b3705c668ff4f353e45bda66d9c5f7e20552f (diff) |
JPA: Fix up @ManyToMany relationships.
IntelliJ does not appear to be capable of detecting many-to-many
relationships, instead generating one-to-many relationships with join
tables. To reflect the data model more accurately, this patch changes
these into actual @ManyToMany properties.
Change-Id: Ib813e7df64b1b3d77df3e7f904d279f320029f4b
Diffstat (limited to 'src/main/scala/eu/mulk/entity/CategoryInclusion.java')
-rw-r--r-- | src/main/scala/eu/mulk/entity/CategoryInclusion.java | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/src/main/scala/eu/mulk/entity/CategoryInclusion.java b/src/main/scala/eu/mulk/entity/CategoryInclusion.java deleted file mode 100644 index 387615f..0000000 --- a/src/main/scala/eu/mulk/entity/CategoryInclusion.java +++ /dev/null @@ -1,80 +0,0 @@ -package eu.mulk.entity; - -import io.quarkus.hibernate.orm.panache.PanacheEntityBase; -import java.util.Objects; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.IdClass; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.Table; - -@Entity -@Table(name = "category_inclusions", schema = "public", catalog = "mulkcms") -@IdClass(CategoryInclusionPK.class) -public class CategoryInclusion extends PanacheEntityBase { - - private int subcategoryId; - private int supercategoryId; - private Category subcategory; - private Category supercategory; - - @Id - @Column(name = "category", nullable = false) - public int getSubcategoryId() { - return subcategoryId; - } - - public void setSubcategoryId(int subcategoryId) { - this.subcategoryId = subcategoryId; - } - - @Id - @Column(name = "supercategory", nullable = false) - public int getSupercategoryId() { - return supercategoryId; - } - - public void setSupercategoryId(int supercategoryId) { - this.supercategoryId = supercategoryId; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - CategoryInclusion that = (CategoryInclusion) o; - return subcategoryId == that.subcategoryId && - supercategoryId == that.supercategoryId; - } - - @Override - public int hashCode() { - return Objects.hash(subcategoryId, supercategoryId); - } - - @ManyToOne - @JoinColumn(name = "category", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public Category getSubcategory() { - return subcategory; - } - - public void setSubcategory(Category subcategory) { - this.subcategory = subcategory; - } - - @ManyToOne - @JoinColumn(name = "supercategory", referencedColumnName = "id", nullable = false, insertable = false, updatable = false) - public Category getSupercategory() { - return supercategory; - } - - public void setSupercategory(Category supercategory) { - this.supercategory = supercategory; - } -} |