diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 15:46:34 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2020-01-12 15:46:34 +0100 |
commit | 2f0b3705c668ff4f353e45bda66d9c5f7e20552f (patch) | |
tree | aa56e2ba044d1eb7fee8d00063b1d1d38a2e8b82 /src/main/scala/eu/mulk/entity/Category.java | |
parent | 4c5847bffd0401e62a3f2beaeba8c0cb887359ce (diff) |
Import autogenerated JPA entities.
Adds JPA entities generated by IntelliJ for all existing tables in the
database.
Change-Id: Iac957b5d68ce45328db87487f105522f8595e124
Diffstat (limited to 'src/main/scala/eu/mulk/entity/Category.java')
-rw-r--r-- | src/main/scala/eu/mulk/entity/Category.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/main/scala/eu/mulk/entity/Category.java b/src/main/scala/eu/mulk/entity/Category.java new file mode 100644 index 0000000..d74ccfb --- /dev/null +++ b/src/main/scala/eu/mulk/entity/Category.java @@ -0,0 +1,77 @@ +package eu.mulk.entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntityBase; +import java.util.Collection; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "categories", schema = "public", catalog = "mulkcms") +public class Category extends PanacheEntityBase { + + private int id; + private String name; + private Collection<CategoryInclusion> supercategories; + private Collection<CategoryInclusion> subcategories; + + @Id + @Column(name = "id", nullable = false) + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + @Basic + @Column(name = "name", nullable = false, length = -1) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return id == category.id && + Objects.equals(name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @OneToMany(mappedBy = "subcategory") + public Collection<CategoryInclusion> getSupercategories() { + return supercategories; + } + + public void setSupercategories(Collection<CategoryInclusion> supercategories) { + this.supercategories = supercategories; + } + + @OneToMany(mappedBy = "supercategory") + public Collection<CategoryInclusion> getSubcategories() { + return subcategories; + } + + public void setSubcategories(Collection<CategoryInclusion> subcategories) { + this.subcategories = subcategories; + } +} |