1 | package tech.techharbor.Model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 | import lombok.Data;
|
---|
5 |
|
---|
6 | import java.util.Objects;
|
---|
7 |
|
---|
8 | @Entity
|
---|
9 | @Data
|
---|
10 | @Table(name = "product", schema = "project", catalog = "db_202324z_va_prj_techharbor")
|
---|
11 | public class ProductModel {
|
---|
12 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
13 | @Id
|
---|
14 | @Column(name = "product_id", nullable = false)
|
---|
15 | private Integer productId;
|
---|
16 | @Basic
|
---|
17 | @Column(name = "product_name", nullable = false, length = 100)
|
---|
18 | private String productName;
|
---|
19 | @Basic
|
---|
20 | @Column(name = "product_description", nullable = false, length = 100)
|
---|
21 | private String productDescription;
|
---|
22 | @Basic
|
---|
23 | @Column(name = "product_price", nullable = false)
|
---|
24 | private Integer productPrice;
|
---|
25 | @Basic
|
---|
26 | @Column(name = "product_warranty", nullable = false)
|
---|
27 | private Integer productWarranty;
|
---|
28 | @Basic
|
---|
29 | @Column(name = "product_image", nullable = false, length = -1)
|
---|
30 | private String productImage;
|
---|
31 | @Basic
|
---|
32 | @Column(name = "manufacturer_id", nullable = false)
|
---|
33 | private Integer manufacturerId;
|
---|
34 | @Basic
|
---|
35 | @Column(name = "service_man_id", nullable = false)
|
---|
36 | private Integer serviceManId;
|
---|
37 |
|
---|
38 | public ProductModel(String productName, String productDescription, Integer productPrice, Integer productWarranty) {
|
---|
39 | this.productName = productName;
|
---|
40 | this.productDescription = productDescription;
|
---|
41 | this.productPrice = productPrice;
|
---|
42 | this.productWarranty = productWarranty;
|
---|
43 | }
|
---|
44 |
|
---|
45 | public ProductModel() {
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override
|
---|
49 | public boolean equals(Object o) {
|
---|
50 | if (this == o) return true;
|
---|
51 | if (o == null || getClass() != o.getClass()) return false;
|
---|
52 | ProductModel that = (ProductModel) o;
|
---|
53 | return Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(productDescription, that.productDescription) && Objects.equals(productPrice, that.productPrice) && Objects.equals(productWarranty, that.productWarranty) && Objects.equals(productImage, that.productImage) && Objects.equals(manufacturerId, that.manufacturerId) && Objects.equals(serviceManId, that.serviceManId);
|
---|
54 | }
|
---|
55 |
|
---|
56 | @Override
|
---|
57 | public int hashCode() {
|
---|
58 | return Objects.hash(productId, productName, productDescription, productPrice, productWarranty, productImage, manufacturerId, serviceManId);
|
---|
59 | }
|
---|
60 | }
|
---|