Guest User

Untitled

a guest
Feb 21st, 2018
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. __________ ________ ________
  2. | | |hospital| | |
  3. |hospitals|----<| doctor |>-----| doctor |
  4. |_________| |________| |________|
  5.  
  6. @Entity
  7. @Table(name = "hospital_doctor")
  8. @IdClass(HospitalDoctorId.class)
  9. public class HospitalDoctor {
  10.  
  11. @Id
  12. private int hospital_id;
  13. @Id
  14. private int doctor_id;
  15.  
  16. @ManyToOne
  17. @JoinColumn(updatable = false, insertable = false)
  18. private Doctor doctor;
  19.  
  20. @ManyToOne
  21. @JoinColumn(updatable = false, insertable = false)
  22. private Hospital hospital;
  23.  
  24. @Id
  25. private int id;
  26. @Temporal(TemporalType.DATE)
  27. private Date contract_start_date;
  28. @Temporal(TemporalType.DATE)
  29. private Date contract_end_date;
  30. private String position;
  31. private String supervisor;
  32. private boolean part_time; //then getters, setters and HospitalDoctor
  33. constructors
  34.  
  35. "exception": "java.lang.NullPointerException",
  36. "message": "No message available",
  37. "path": "/api/hospitaldoctors"
  38.  
  39. public List<HospitalDoctor> getAll() {
  40. List<HospitalDoctor> hospitaldoctors = new ArrayList<>();
  41. hospitalDoctorDao.findAll().forEach(hospitaldoctors::add);
  42. return hospitaldoctors;
  43. }
  44.  
  45. @GetMapping(value="/api/hospitaldoctors")
  46. public List<HospitalDoctor> getAll(){
  47. return hospitalDoctorService.getAll();
  48. }
Add Comment
Please, Sign In to add comment