Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- __________ ________ ________
- | | |hospital| | |
- |hospitals|----<| doctor |>-----| doctor |
- |_________| |________| |________|
- @Entity
- @Table(name = "hospital_doctor")
- @IdClass(HospitalDoctorId.class)
- public class HospitalDoctor {
- @Id
- private int hospital_id;
- @Id
- private int doctor_id;
- @ManyToOne
- @JoinColumn(updatable = false, insertable = false)
- private Doctor doctor;
- @ManyToOne
- @JoinColumn(updatable = false, insertable = false)
- private Hospital hospital;
- @Id
- private int id;
- @Temporal(TemporalType.DATE)
- private Date contract_start_date;
- @Temporal(TemporalType.DATE)
- private Date contract_end_date;
- private String position;
- private String supervisor;
- private boolean part_time; //then getters, setters and HospitalDoctor
- constructors
- "exception": "java.lang.NullPointerException",
- "message": "No message available",
- "path": "/api/hospitaldoctors"
- public List<HospitalDoctor> getAll() {
- List<HospitalDoctor> hospitaldoctors = new ArrayList<>();
- hospitalDoctorDao.findAll().forEach(hospitaldoctors::add);
- return hospitaldoctors;
- }
- @GetMapping(value="/api/hospitaldoctors")
- public List<HospitalDoctor> getAll(){
- return hospitalDoctorService.getAll();
- }
Add Comment
Please, Sign In to add comment