main
Last change
on this file since f094f6c was 2e46f06, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 22 months ago |
Adding the models and testing one view
|
-
Property mode
set to
100644
|
File size:
913 bytes
|
Line | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.Entity;
|
---|
4 | import jakarta.persistence.Id;
|
---|
5 | import jakarta.persistence.JoinColumn;
|
---|
6 | import jakarta.persistence.ManyToOne;
|
---|
7 | import lombok.*;
|
---|
8 | import org.hibernate.Hibernate;
|
---|
9 |
|
---|
10 | import java.time.LocalDate;
|
---|
11 | import java.util.Objects;
|
---|
12 |
|
---|
13 | @Entity
|
---|
14 | @Getter
|
---|
15 | @Setter
|
---|
16 | @ToString
|
---|
17 | @RequiredArgsConstructor
|
---|
18 | public 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.