44import jakarta .persistence .GeneratedValue ;
55import jakarta .persistence .GenerationType ;
66import jakarta .persistence .Id ;
7+ import jakarta .persistence .Table ;
78
89@ Entity
10+ @ Table (name = "doctors" ) // Chỉ định tên bảng
911public class Doctor {
1012
11- // THÊM: @ Id và @ GeneratedValue
13+ // Primary Key và Tự động tăng ( Id và GeneratedValue)
1214 @ Id
1315 @ GeneratedValue (strategy = GenerationType .IDENTITY )
1416 private Long id ;
@@ -18,13 +20,13 @@ public class Doctor {
1820 private String specialization ;
1921 private String licenseNumber ;
2022 private String email ;
21- private String password ; // Trong thực tế, cần xử lý bảo mật cho mật khẩu
23+ private String password ; // Lưu ý bảo mật: Cần mã hóa (hashing) trong ứng dụng thực tế
2224
23- // THÊM: Constructor mặc định (cần thiết cho JPA)
25+ // 1. Constructor mặc định (Cần thiết cho JPA)
2426 public Doctor () {
2527 }
2628
27- // THÊM: Constructor có tham số (tùy chọn nhưng hữu ích )
29+ // 2. Constructor có tham số (Hữu ích để tạo đối tượng mới )
2830 public Doctor (String firstName , String lastName , String specialization , String licenseNumber , String email , String password ) {
2931 this .firstName = firstName ;
3032 this .lastName = lastName ;
@@ -34,8 +36,7 @@ public Doctor(String firstName, String lastName, String specialization, String l
3436 this .password = password ;
3537 }
3638
37- // THÊM: Getters and Setters cho tất cả các trường
38- // (Bạn nên thêm đầy đủ các phương thức này ở đây)
39+ // 3. GETTERS và SETTERS (ĐÁP ỨNG YÊU CẦU BỊ THIẾU)
3940
4041 public Long getId () {
4142 return id ;
@@ -44,11 +45,52 @@ public Long getId() {
4445 public void setId (Long id ) {
4546 this .id = id ;
4647 }
47-
48- // ... các getters/setters khác ...
49-
48+
5049 public String getFirstName () {
5150 return firstName ;
5251 }
53- // ...
52+
53+ public void setFirstName (String firstName ) {
54+ this .firstName = firstName ;
55+ }
56+
57+ public String getLastName () {
58+ return lastName ;
59+ }
60+
61+ public void setLastName (String lastName ) {
62+ this .lastName = lastName ;
63+ }
64+
65+ public String getSpecialization () {
66+ return specialization ;
67+ }
68+
69+ public void setSpecialization (String specialization ) {
70+ this .specialization = specialization ;
71+ }
72+
73+ public String getLicenseNumber () {
74+ return licenseNumber ;
75+ }
76+
77+ public void setLicenseNumber (String licenseNumber ) {
78+ this .licenseNumber = licenseNumber ;
79+ }
80+
81+ public String getEmail () {
82+ return email ;
83+ }
84+
85+ public void setEmail (String email ) {
86+ this .email = email ;
87+ }
88+
89+ public String getPassword () {
90+ return password ;
91+ }
92+
93+ public void setPassword (String password ) {
94+ this .password = password ;
95+ }
5496}
0 commit comments