1 | package project.fmo.app.projcetfmo.Model;
|
---|
2 |
|
---|
3 | import project.fmo.app.projcetfmo.Service.impl.DostavaServiceImpl;
|
---|
4 |
|
---|
5 | import javax.persistence.*;
|
---|
6 |
|
---|
7 | import java.sql.Date;
|
---|
8 | import java.util.Objects;
|
---|
9 |
|
---|
10 | @Entity
|
---|
11 | @Table(schema = "project", name = "dostava", catalog = "db_202223z_va_prj_fmo")
|
---|
12 | public class Dostava {
|
---|
13 | @ManyToOne
|
---|
14 | @JoinColumn(name = "id_korisnik")
|
---|
15 | private Dostavuvac dostavuvac;
|
---|
16 | @OneToOne
|
---|
17 | @JoinColumn(name = "id_naracka")
|
---|
18 | private Naracka naracka;
|
---|
19 | @Id
|
---|
20 | @Column(name = "id_dostava")
|
---|
21 | private int idDostava;
|
---|
22 | @Basic
|
---|
23 | @Column(name = "datum")
|
---|
24 | private Date datum;
|
---|
25 | @Basic
|
---|
26 | @Column(name = "status")
|
---|
27 | private String status;
|
---|
28 |
|
---|
29 | public Dostava (){}
|
---|
30 |
|
---|
31 | public Dostava(Dostavuvac dostavuvac, Naracka naracka, int idDostava, Date datum, String status) {
|
---|
32 | this.dostavuvac = dostavuvac;
|
---|
33 | this.naracka = naracka;
|
---|
34 | this.idDostava = idDostava;
|
---|
35 | this.datum = datum;
|
---|
36 | this.status = status;
|
---|
37 | }
|
---|
38 |
|
---|
39 | public int getIdKorisnik() {
|
---|
40 | return dostavuvac.getIdKorisnik();
|
---|
41 | }
|
---|
42 |
|
---|
43 | public void setIdKorisnik(int idKorisnik) {
|
---|
44 | this.dostavuvac.setIdKorisnik(idKorisnik);
|
---|
45 | }
|
---|
46 |
|
---|
47 | public int getIdNaracka() {
|
---|
48 | return naracka.getIdNaracka();
|
---|
49 | }
|
---|
50 |
|
---|
51 | public void setIdNaracka(int idNaracka) {
|
---|
52 | this.naracka.setIdNaracka(idNaracka);
|
---|
53 | }
|
---|
54 |
|
---|
55 | public int getIdDostava() {
|
---|
56 | return idDostava;
|
---|
57 | }
|
---|
58 |
|
---|
59 | public void setIdDostava(int idDostava) {
|
---|
60 | this.idDostava = idDostava;
|
---|
61 | }
|
---|
62 |
|
---|
63 | public Date getDatum() {
|
---|
64 | return datum;
|
---|
65 | }
|
---|
66 |
|
---|
67 | public void setDatum(Date datum) {
|
---|
68 | this.datum = datum;
|
---|
69 | }
|
---|
70 |
|
---|
71 | public String getStatus() {
|
---|
72 | return status;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public void setStatus(String status) {
|
---|
76 | this.status = status;
|
---|
77 | }
|
---|
78 |
|
---|
79 | @Override
|
---|
80 | public boolean equals(Object o) {
|
---|
81 | if (this == o) return true;
|
---|
82 | if (o == null || getClass() != o.getClass()) return false;
|
---|
83 | Dostava dostava = (Dostava) o;
|
---|
84 | return dostavuvac == dostava.dostavuvac && naracka == dostava.naracka && idDostava == dostava.idDostava && Objects.equals(datum, dostava.datum) && Objects.equals(status, dostava.status);
|
---|
85 | }
|
---|
86 |
|
---|
87 | @Override
|
---|
88 | public int hashCode() {
|
---|
89 | return Objects.hash(dostavuvac, naracka, idDostava, datum, status);
|
---|
90 | }
|
---|
91 | }
|
---|