source: src/main/java/com/example/medweb/model/Doktor.java@ 09b34bc

Last change on this file since 09b34bc was e5fefbd, checked in by Anita Terziska <63020646+Nit4e@…>, 2 years ago

initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1package com.example.medweb.model;
2
3
4import lombok.Data;
5import org.hibernate.annotations.Fetch;
6import org.hibernate.annotations.FetchMode;
7
8import javax.persistence.*;
9import java.io.Serializable;
10import java.util.List;
11
12
13@Data
14@Entity
15@PrimaryKeyJoinColumn(name = "doktor_id")
16public class Doktor extends Covek implements Serializable {
17
18 private String opis;
19 private Integer br_licenca;
20
21
22
23 @ManyToOne
24 @JoinColumn(name = "spec_id", referencedColumnName = "spec_id", nullable = true)
25 private Specijalnost specijalnost;
26
27 @ManyToOne
28 @JoinColumns({
29 @JoinColumn(name = "bolnica_id", referencedColumnName = "bolnica_id", nullable = false),
30 @JoinColumn(name = "oddel_id", referencedColumnName = "oddel_id", nullable = false)
31 })
32 private Oddel oddel;
33
34 @OneToMany(mappedBy = "doktor", fetch = FetchType.EAGER, cascade = CascadeType.REFRESH)
35 @Fetch(value = FetchMode.SUBSELECT)
36 private List<Termin> terminList;
37
38 @OneToMany(mappedBy = "doktor", fetch = FetchType.EAGER)
39 @Fetch(value = FetchMode.SUBSELECT)
40 private List<Pregled> pregledList;
41
42 public Doktor () {}
43
44 public Doktor(String email, String pass, String embg, String ime, String prezime, String opis,
45 Integer br_licenca, Specijalnost specijalnost, Oddel oddel, List<Termin> terminList,
46 List<Pregled> pregledList) {
47 super(email, pass, embg, ime, prezime);
48 this.opis = opis;
49 this.br_licenca = br_licenca;
50 this.specijalnost = specijalnost;
51 this.oddel = oddel;
52 this.terminList = terminList;
53 this.pregledList = pregledList;
54 }
55}
Note: See TracBrowser for help on using the repository browser.