source: src/main/java/com/example/autopartz/model/Price.java@ 2e46f06

main
Last change on this file since 2e46f06 was 2e46f06, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 19 months ago

Adding the models and testing one view

  • Property mode set to 100644
File size: 913 bytes
Line 
1package com.example.autopartz.model;
2
3import jakarta.persistence.Entity;
4import jakarta.persistence.Id;
5import jakarta.persistence.JoinColumn;
6import jakarta.persistence.ManyToOne;
7import lombok.*;
8import org.hibernate.Hibernate;
9
10import java.time.LocalDate;
11import java.util.Objects;
12
13@Entity
14@Getter
15@Setter
16@ToString
17@RequiredArgsConstructor
18public class Price {
19 @Id
20 Long ID_price;
21 Integer amount;
22 LocalDate price_from;
23 LocalDate price_till;
24 @ManyToOne
25 @JoinColumn(name = "id_part")
26 Part part;
27
28 @Override
29 public boolean equals(Object o) {
30 if (this == o) return true;
31 if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
32 Price price = (Price) o;
33 return ID_price != null && Objects.equals(ID_price, price.ID_price);
34 }
35
36 @Override
37 public int hashCode() {
38 return getClass().hashCode();
39 }
40}
Note: See TracBrowser for help on using the repository browser.