main
Last change
on this file was 4d67d70, checked in by andrejtodorovski <82031894+andrejtodorovski@…>, 23 months ago |
Final touches
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | package com.example.autopartz.model;
|
---|
2 |
|
---|
3 | import lombok.Getter;
|
---|
4 | import lombok.RequiredArgsConstructor;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 | import org.hibernate.Hibernate;
|
---|
8 |
|
---|
9 | import javax.persistence.*;
|
---|
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 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
21 | Integer ID_price;
|
---|
22 | Integer amount;
|
---|
23 | LocalDate price_from;
|
---|
24 | LocalDate price_till;
|
---|
25 | @ManyToOne
|
---|
26 | @JoinColumn(name = "id_part")
|
---|
27 | Part part;
|
---|
28 |
|
---|
29 | public Price(Integer amount, LocalDate price_from, Part part) {
|
---|
30 | this.amount = amount;
|
---|
31 | this.price_from = price_from;
|
---|
32 | this.part = part;
|
---|
33 | }
|
---|
34 |
|
---|
35 | @Override
|
---|
36 | public boolean equals(Object o) {
|
---|
37 | if (this == o) return true;
|
---|
38 | if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
|
---|
39 | Price price = (Price) o;
|
---|
40 | return ID_price != null && Objects.equals(ID_price, price.ID_price);
|
---|
41 | }
|
---|
42 |
|
---|
43 | @Override
|
---|
44 | public int hashCode() {
|
---|
45 | return getClass().hashCode();
|
---|
46 | }
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.