content: package com.adyen.demo.store.domain;
  
  import com.adyen.demo.store.domain.enumeration.Size;
  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  import io.swagger.annotations.ApiModel;
  import java.io.Serializable;
  import java.math.BigDecimal;
  import javax.persistence.*;
  import javax.validation.constraints.*;
  import org.hibernate.annotations.Cache;
  import org.hibernate.annotations.CacheConcurrencyStrategy;
  
  /**
   * Product sold by the Online store
   */
  @ApiModel(description = "Product sold by the Online store")
  @Entity
  @Table(name = "product")
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  public class Product implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @NotNull
      @Column(name = "name", nullable = false)
      private String name;
  
      @Column(name = "description")
      private String description;
  
      @NotNull
      @DecimalMin(value = "0")
      @Column(name = "price", precision = 21, scale = 2, nullable = false)
      private BigDecimal price;
  
      @NotNull
      @Enumerated(EnumType.STRING)
      @Column(name = "item_size", nullable = false)
      private Size itemSize;
  
      @Lob
      @Column(name = "image")
      private byte[] image;
  
      @Column(name = "image_content_type")
      private String imageContentType;
  
      @ManyToOne(optional = false)
      @NotNull
      @JsonIgnoreProperties(value = { "products" }, allowSetters = true)
      private ProductCategory productCategory;
  
      // jhipster-needle-entity-add-field - JHipster will add fields here
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public Product id(Long id) {
          this.id = id;
          return this;
      }
  
      public String getName() {
          return this.name;
      }
  
      public Product name(String name) {
          this.name = name;
          return this;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getDescription() {
          return this.description;
      }
  
      public Product description(String description) {
          this.description = description;
          return this;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public BigDecimal getPrice() {
          return this.price;
      }
  
      public Product price(BigDecimal price) {
          this.price = price;
          return this;
      }
  
      public void setPrice(BigDecimal price) {
          this.price = price;
      }
  
      public Size getItemSize() {
          return this.itemSize;
      }
  
      public Product itemSize(Size itemSize) {
          this.itemSize = itemSize;
          return this;
      }
  
      public void setItemSize(Size itemSize) {
          this.itemSize = itemSize;
      }
  
      public byte[] getImage() {
          return this.image;
      }
  
      public Product image(byte[] image) {
          this.image = image;
          return this;
      }
  
      public void setImage(byte[] image) {
          this.image = image;
      }
  
      public String getImageContentType() {
          return this.imageContentType;
      }
  
      public Product imageContentType(String imageContentType) {
          this.imageContentType = imageContentType;
          return this;
      }
  
      public void setImageContentType(String imageContentType) {
          this.imageContentType = imageContentType;
      }
  
      public ProductCategory getProductCategory() {
          return this.productCategory;
      }
  
      public Product productCategory(ProductCategory productCategory) {
          this.setProductCategory(productCategory);
          return this;
      }
  
      public void setProductCategory(ProductCategory productCategory) {
          this.productCategory = productCategory;
      }
  
      // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
  
      @Override
      public boolean equals(Object o) {
          if (this == o) {
              return true;
          }
          if (!(o instanceof Product)) {
              return false;
          }
          return id != null && id.equals(((Product) o).id);
      }
  
      @Override
      public int hashCode() {
          // see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
          return getClass().hashCode();
      }
  
      // prettier-ignore
      @Override
      public String toString() {
          return "Product{" +
              "id=" + getId() +
              ", name='" + getName() + "'" +
              ", description='" + getDescription() + "'" +
              ", price=" + getPrice() +
              ", itemSize='" + getItemSize() + "'" +
              ", image='" + getImage() + "'" +
              ", imageContentType='" + getImageContentType() + "'" +
              "}";
      }
  }
  