diff options
Diffstat (limited to 'src/main/scala/eu/mulk/entity/CategoryInclusionPK.java')
-rw-r--r-- | src/main/scala/eu/mulk/entity/CategoryInclusionPK.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/scala/eu/mulk/entity/CategoryInclusionPK.java b/src/main/scala/eu/mulk/entity/CategoryInclusionPK.java new file mode 100644 index 0000000..6ca2e03 --- /dev/null +++ b/src/main/scala/eu/mulk/entity/CategoryInclusionPK.java @@ -0,0 +1,50 @@ +package eu.mulk.entity; + +import java.io.Serializable; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Id; + +public class CategoryInclusionPK implements Serializable { + + private int subcategoryId; + private int supercategoryId; + + @Column(name = "category", nullable = false) + @Id + public int getSubcategoryId() { + return subcategoryId; + } + + public void setSubcategoryId(int subcategoryId) { + this.subcategoryId = subcategoryId; + } + + @Column(name = "supercategory", nullable = false) + @Id + 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; + } + CategoryInclusionPK that = (CategoryInclusionPK) o; + return subcategoryId == that.subcategoryId && + supercategoryId == that.supercategoryId; + } + + @Override + public int hashCode() { + return Objects.hash(subcategoryId, supercategoryId); + } +} |