Legend:
- Unmodified
- Added
- Removed
-
src/main/java/project/fmo/app/projcetfmo/Model/Dostava.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import jakarta.persistence.*; 3 import project.fmo.app.projcetfmo.Service.impl.DostavaServiceImpl; 4 5 import javax.persistence.*; 4 6 5 7 import java.sql.Date; … … 7 9 8 10 @Entity 11 @Table(schema = "project", name = "dostava", catalog = "db_202223z_va_prj_fmo") 9 12 public class Dostava { 10 @Basic 11 @Column(name = "id_korisnik") 12 private int idKorisnik; 13 @Basic 14 @Column(name = "id_naracka") 15 private int idNaracka; 16 @GeneratedValue(strategy = GenerationType.IDENTITY) 13 @ManyToOne 14 @JoinColumn(name = "id_korisnik") 15 private Dostavuvac dostavuvac; 16 @OneToOne 17 @JoinColumn(name = "id_naracka") 18 private Naracka naracka; 17 19 @Id 18 20 @Column(name = "id_dostava") … … 25 27 private String status; 26 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 27 39 public int getIdKorisnik() { 28 return idKorisnik;40 return dostavuvac.getIdKorisnik(); 29 41 } 30 42 31 43 public void setIdKorisnik(int idKorisnik) { 32 this. idKorisnik = idKorisnik;44 this.dostavuvac.setIdKorisnik(idKorisnik); 33 45 } 34 46 35 47 public int getIdNaracka() { 36 return idNaracka;48 return naracka.getIdNaracka(); 37 49 } 38 50 39 51 public void setIdNaracka(int idNaracka) { 40 this. idNaracka = idNaracka;52 this.naracka.setIdNaracka(idNaracka); 41 53 } 42 54 … … 70 82 if (o == null || getClass() != o.getClass()) return false; 71 83 Dostava dostava = (Dostava) o; 72 return idKorisnik == dostava.idKorisnik && idNaracka == dostava.idNaracka && idDostava == dostava.idDostava && Objects.equals(datum, dostava.datum) && Objects.equals(status, dostava.status);84 return dostavuvac == dostava.dostavuvac && naracka == dostava.naracka && idDostava == dostava.idDostava && Objects.equals(datum, dostava.datum) && Objects.equals(status, dostava.status); 73 85 } 74 86 75 87 @Override 76 88 public int hashCode() { 77 return Objects.hash( idKorisnik, idNaracka, idDostava, datum, status);89 return Objects.hash(dostavuvac, naracka, idDostava, datum, status); 78 90 } 79 91 }
Note:
See TracChangeset
for help on using the changeset viewer.