package com.project.beautycenter.model; import javax.persistence.*; import java.util.LinkedHashSet; import java.util.Set; @Entity @Table(name = "klienti",schema = "project") public class Klienti { @Id @Column(name = "user_id", nullable = false) private Integer id; @MapsId @OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, optional = false) @JoinColumn(name = "user_id", nullable = false) private Users users; @Column(name = "ime", nullable = false, length = 100) private String ime; @Column(name = "prezime", length = 100) private String prezime; @Column(name = "tel_br", nullable = false, length = 12) private String telBr; @Column(name = "e_mail", length = 150) private String eMail; @OneToMany(mappedBy = "klienti") private Set rezervacijas = new LinkedHashSet<>(); @OneToMany(mappedBy = "klienti") private Set ocenas = new LinkedHashSet<>(); public Set getOcenas() { return ocenas; } public void setOcenas(Set ocenas) { this.ocenas = ocenas; } public Set getRezervacijas() { return rezervacijas; } public void setRezervacijas(Set rezervacijas) { this.rezervacijas = rezervacijas; } public Klienti(){ } public Klienti(Integer id, Users users, String ime, String prezime, String telBr, String eMail) { this.id = id; this.users = users; this.ime = ime; this.prezime = prezime; this.telBr = telBr; this.eMail = eMail; } public Klienti(Integer id, String ime, String prezime, String telBr, String eMail) { this.id = id; this.ime = ime; this.prezime = prezime; this.telBr = telBr; this.eMail = eMail; } public Klienti(Users users, String ime, String prezime, String telBr, String eMail) { this.users = users; this.ime = ime; this.prezime = prezime; this.telBr = telBr; this.eMail = eMail; this.id = users.getId(); } public String getEMail() { return eMail; } public void setEMail(String eMail) { this.eMail = eMail; } public String getTelBr() { return telBr; } public void setTelBr(String telBr) { this.telBr = telBr; } public String getPrezime() { return prezime; } public void setPrezime(String prezime) { this.prezime = prezime; } public String getIme() { return ime; } public void setIme(String ime) { this.ime = ime; } public Users getUsers() { return users; } public void setUsers(Users users) { this.users = users; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } }