diff --git a/eShopModernizedSpringSolution/src/main/java/com/eshop/modernized/model/CatalogBrand.java b/eShopModernizedSpringSolution/src/main/java/com/eshop/modernized/model/CatalogBrand.java new file mode 100644 index 00000000..c401e669 --- /dev/null +++ b/eShopModernizedSpringSolution/src/main/java/com/eshop/modernized/model/CatalogBrand.java @@ -0,0 +1,66 @@ +package com.eshop.modernized.model; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.util.Objects; + +@Entity +@Table(name = "CatalogBrand") +public class CatalogBrand { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @NotNull + @Size(max = 100) + @Column(nullable = false, length = 100) + private String brand; + + protected CatalogBrand() { + } + + public CatalogBrand(String brand) { + this.brand = brand; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getBrand() { + return brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof CatalogBrand other)) return false; + return Objects.equals(brand, other.brand); + } + + @Override + public int hashCode() { + return Objects.hash(brand); + } + + @Override + public String toString() { + return brand; + } +} diff --git a/eShopModernizedSpringSolution/src/main/java/com/eshop/modernized/model/CatalogType.java b/eShopModernizedSpringSolution/src/main/java/com/eshop/modernized/model/CatalogType.java new file mode 100644 index 00000000..31b1b083 --- /dev/null +++ b/eShopModernizedSpringSolution/src/main/java/com/eshop/modernized/model/CatalogType.java @@ -0,0 +1,66 @@ +package com.eshop.modernized.model; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; + +import java.util.Objects; + +@Entity +@Table(name = "CatalogType") +public class CatalogType { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Integer id; + + @NotNull + @Size(max = 100) + @Column(nullable = false, length = 100) + private String type; + + protected CatalogType() { + } + + public CatalogType(String type) { + this.type = type; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof CatalogType other)) return false; + return Objects.equals(type, other.type); + } + + @Override + public int hashCode() { + return Objects.hash(type); + } + + @Override + public String toString() { + return type; + } +}