Legend:
- Unmodified
- Added
- Removed
-
src/main/java/project/fmo/app/projcetfmo/Model/Naracka.java
r1dd9226 rd14176d 1 package model;1 package project.fmo.app.projcetfmo.Model; 2 2 3 import ja karta.persistence.*;3 import javax.persistence.*; 4 4 5 5 import java.sql.Date; … … 7 7 8 8 @Entity 9 @Table(schema = "project", name = "naracka", catalog = "db_202223z_va_prj_fmo") 9 10 public class Naracka { 10 11 @GeneratedValue(strategy = GenerationType.IDENTITY) … … 24 25 @Column(name = "adresa") 25 26 private String adresa; 26 @Basic 27 @Column(name = "id_korisnik") 28 private int idKorisnik; 27 @ManyToOne 28 @JoinColumn(name = "id_korisnik") 29 private Kupuvac kupuvac; 30 31 public Naracka(){} 32 33 public Naracka(int vkupnoSuma, Date datum, String status, String adresa, Kupuvac kupuvac) { 34 this.vkupnoSuma = vkupnoSuma; 35 this.datum = datum; 36 this.status = status; 37 this.adresa = adresa; 38 this.kupuvac = kupuvac; 39 } 29 40 30 41 public int getIdNaracka() { … … 69 80 70 81 public int getIdKorisnik() { 71 return idKorisnik;82 return kupuvac.getIdKorisnik(); 72 83 } 73 84 74 85 public void setIdKorisnik(int idKorisnik) { 75 this. idKorisnik = idKorisnik;86 this.kupuvac.setIdKorisnik(idKorisnik); 76 87 } 77 88 … … 81 92 if (o == null || getClass() != o.getClass()) return false; 82 93 Naracka naracka = (Naracka) o; 83 return idNaracka == naracka.idNaracka && vkupnoSuma == naracka.vkupnoSuma && idKorisnik == naracka.idKorisnik&& Objects.equals(datum, naracka.datum) && Objects.equals(status, naracka.status) && Objects.equals(adresa, naracka.adresa);94 return idNaracka == naracka.idNaracka && vkupnoSuma == naracka.vkupnoSuma && kupuvac == naracka.kupuvac && Objects.equals(datum, naracka.datum) && Objects.equals(status, naracka.status) && Objects.equals(adresa, naracka.adresa); 84 95 } 85 96 86 97 @Override 87 98 public int hashCode() { 88 return Objects.hash(idNaracka, vkupnoSuma, datum, status, adresa, idKorisnik);99 return Objects.hash(idNaracka, vkupnoSuma, datum, status, adresa, kupuvac); 89 100 } 90 101 }
Note:
See TracChangeset
for help on using the changeset viewer.