1 | package com.example.medweb.model;
|
---|
2 |
|
---|
3 |
|
---|
4 | import lombok.Data;
|
---|
5 | import org.hibernate.annotations.Fetch;
|
---|
6 | import org.hibernate.annotations.FetchMode;
|
---|
7 |
|
---|
8 | import javax.persistence.*;
|
---|
9 | import java.io.Serializable;
|
---|
10 | import java.util.List;
|
---|
11 |
|
---|
12 |
|
---|
13 | @Data
|
---|
14 | @Entity
|
---|
15 | @PrimaryKeyJoinColumn(name = "doktor_id")
|
---|
16 | public 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 | }
|
---|