File tree 2 files changed +25
-0
lines changed
3-0-jpa-and-hibernate/3-1-1-employee-profile/src/main/java/com/bobocode/model
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change 4
4
import lombok .NoArgsConstructor ;
5
5
import lombok .Setter ;
6
6
7
+ import javax .persistence .*;
8
+
7
9
/**
8
10
* todo:
9
11
* - configure JPA entity
16
18
@ NoArgsConstructor
17
19
@ Getter
18
20
@ Setter
21
+ @ Entity
22
+ @ Table (name = "employee" )
19
23
public class Employee {
24
+ @ Id
25
+ @ GeneratedValue
20
26
private Long id ;
27
+
28
+ @ Column (nullable = false )
21
29
private String email ;
30
+
31
+ @ Column (nullable = false )
22
32
private String fistName ;
33
+
34
+ @ Column (nullable = false )
23
35
private String lastName ;
24
36
}
Original file line number Diff line number Diff line change 4
4
import lombok .NoArgsConstructor ;
5
5
import lombok .Setter ;
6
6
7
+ import javax .persistence .*;
8
+
7
9
/**
8
10
* todo:
9
11
* - configure JPA entity
16
18
@ NoArgsConstructor
17
19
@ Getter
18
20
@ Setter
21
+ @ Entity
22
+ @ Table (name = "employee_profile" )
19
23
public class EmployeeProfile {
24
+ @ Id
20
25
private Long id ;
26
+
27
+ @ MapsId
28
+ @ OneToOne
29
+ @ JoinColumn (name = "employee_id" )
21
30
private Employee employee ;
31
+
32
+ @ Column (nullable = false )
22
33
private String position ;
34
+
35
+ @ Column (nullable = false )
23
36
private String department ;
24
37
}
You can’t perform that action at this time.
0 commit comments