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.0 KB
|
Line | |
---|
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.util.List;
|
---|
10 |
|
---|
11 |
|
---|
12 | @Data
|
---|
13 | @Entity
|
---|
14 | @IdClass(OddelId.class)
|
---|
15 | public class Oddel {
|
---|
16 |
|
---|
17 | @Id
|
---|
18 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
19 | private Integer oddel_id;
|
---|
20 |
|
---|
21 | @ManyToOne
|
---|
22 | @JoinColumn(name = "bolnica_id", referencedColumnName = "bolnica_id", nullable = false)
|
---|
23 | @Id
|
---|
24 | private Bolnica bolnica_id;
|
---|
25 |
|
---|
26 | private String naziv;
|
---|
27 |
|
---|
28 | @ManyToOne
|
---|
29 | @JoinColumn(name = "spec_id", referencedColumnName = "spec_id", nullable = true)
|
---|
30 | private Specijalnost specijalnost;
|
---|
31 |
|
---|
32 | @OneToMany(mappedBy = "oddel", fetch = FetchType.EAGER)
|
---|
33 | @Fetch(value = FetchMode.SUBSELECT)
|
---|
34 | private List<Doktor> doktorList;
|
---|
35 |
|
---|
36 | public Oddel() {
|
---|
37 | }
|
---|
38 |
|
---|
39 | public Oddel(String naziv, Specijalnost specijalnost, List<Doktor> doktorList) {
|
---|
40 | this.naziv = naziv;
|
---|
41 | this.specijalnost = specijalnost;
|
---|
42 | this.doktorList = doktorList;
|
---|
43 | }
|
---|
44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.