1 | package project.fmo.app.projcetfmo.Model;
|
---|
2 |
|
---|
3 | import javax.persistence.*;
|
---|
4 |
|
---|
5 | import java.sql.Date;
|
---|
6 | import java.util.Objects;
|
---|
7 |
|
---|
8 | @Entity
|
---|
9 | @Table(schema = "project", name = "cena", catalog = "db_202223z_va_prj_fmo")
|
---|
10 | @IdClass(CenaPK.class)
|
---|
11 | public class Cena {
|
---|
12 | @Id
|
---|
13 | @Column(name = "id_produkt")
|
---|
14 | private int idProdukt;
|
---|
15 | @Id
|
---|
16 | @Column(name = "cena_od")
|
---|
17 | private Date cenaOd;
|
---|
18 | @Basic
|
---|
19 | @Column(name = "cena_do")
|
---|
20 | private Date cenaDo;
|
---|
21 | @Basic
|
---|
22 | @Column(name = "iznos")
|
---|
23 | private int iznos;
|
---|
24 |
|
---|
25 | public Cena(){}
|
---|
26 | public Cena(int idProdukt, Date cenaOd, Date cenaDo, int iznos) {
|
---|
27 | this.idProdukt = idProdukt;
|
---|
28 | this.cenaOd = cenaOd;
|
---|
29 | this.cenaDo = cenaDo;
|
---|
30 | this.iznos = iznos;
|
---|
31 | }
|
---|
32 |
|
---|
33 | public Cena(int idProdukt, Date cenaOd, int iznos) {
|
---|
34 | this.idProdukt = idProdukt;
|
---|
35 | this.cenaOd = cenaOd;
|
---|
36 | this.iznos = iznos;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public int getIdProdukt() {
|
---|
40 | return idProdukt;
|
---|
41 | }
|
---|
42 |
|
---|
43 | public void setIdProdukt(int idProdukt) {
|
---|
44 | this.idProdukt = idProdukt;
|
---|
45 | }
|
---|
46 |
|
---|
47 | public Date getCenaOd() {
|
---|
48 | return cenaOd;
|
---|
49 | }
|
---|
50 |
|
---|
51 | public void setCenaOd(Date cenaOd) {
|
---|
52 | this.cenaOd = cenaOd;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public Date getCenaDo() {
|
---|
56 | return cenaDo;
|
---|
57 | }
|
---|
58 |
|
---|
59 | public void setCenaDo(Date cenaDo) {
|
---|
60 | this.cenaDo = cenaDo;
|
---|
61 | }
|
---|
62 |
|
---|
63 | public int getIznos() {
|
---|
64 | return iznos;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public void setIznos(int iznos) {
|
---|
68 | this.iznos = iznos;
|
---|
69 | }
|
---|
70 |
|
---|
71 | @Override
|
---|
72 | public boolean equals(Object o) {
|
---|
73 | if (this == o) return true;
|
---|
74 | if (o == null || getClass() != o.getClass()) return false;
|
---|
75 | Cena cena = (Cena) o;
|
---|
76 | return idProdukt == cena.idProdukt && iznos == cena.iznos && Objects.equals(cenaOd, cena.cenaOd) && Objects.equals(cenaDo, cena.cenaDo);
|
---|
77 | }
|
---|
78 |
|
---|
79 | @Override
|
---|
80 | public int hashCode() {
|
---|
81 | return Objects.hash(idProdukt, cenaOd, cenaDo, iznos);
|
---|
82 | }
|
---|
83 | }
|
---|