Ignore:
Timestamp:
07/07/23 12:14:58 (16 months ago)
Author:
HristijanMitic00 <hristijan.mitic.01@…>
Branches:
main
Parents:
1dd9226
Message:

First commit

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/project/fmo/app/projcetfmo/Model/Naracka.java

    r1dd9226 rd14176d  
    1 package model;
     1package project.fmo.app.projcetfmo.Model;
    22
    3 import jakarta.persistence.*;
     3import javax.persistence.*;
    44
    55import java.sql.Date;
     
    77
    88@Entity
     9@Table(schema = "project", name = "naracka",  catalog = "db_202223z_va_prj_fmo")
    910public class Naracka {
    1011    @GeneratedValue(strategy = GenerationType.IDENTITY)
     
    2425    @Column(name = "adresa")
    2526    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    }
    2940
    3041    public int getIdNaracka() {
     
    6980
    7081    public int getIdKorisnik() {
    71         return idKorisnik;
     82        return kupuvac.getIdKorisnik();
    7283    }
    7384
    7485    public void setIdKorisnik(int idKorisnik) {
    75         this.idKorisnik = idKorisnik;
     86        this.kupuvac.setIdKorisnik(idKorisnik);
    7687    }
    7788
     
    8192        if (o == null || getClass() != o.getClass()) return false;
    8293        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);
    8495    }
    8596
    8697    @Override
    8798    public int hashCode() {
    88         return Objects.hash(idNaracka, vkupnoSuma, datum, status, adresa, idKorisnik);
     99        return Objects.hash(idNaracka, vkupnoSuma, datum, status, adresa, kupuvac);
    89100    }
    90101}
Note: See TracChangeset for help on using the changeset viewer.