File tree 4 files changed +24
-3
lines changed
src/main/java/com/rhkr8521/iccas_question/api
4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .rhkr8521 .iccas_question .api .answer .domain ;
2
2
3
+ import com .rhkr8521 .iccas_question .api .member .domain .Member ;
3
4
import com .rhkr8521 .iccas_question .api .question .domain .Question ;
4
5
import com .rhkr8521 .iccas_question .common .entity .BaseTimeEntity ;
5
6
import jakarta .persistence .*;
@@ -20,7 +21,9 @@ public class Answer extends BaseTimeEntity {
20
21
@ JoinColumn (name = "questionId" )
21
22
private Question question ;
22
23
23
- private String userId ;
24
+ @ ManyToOne (fetch = FetchType .LAZY )
25
+ @ JoinColumn (name = "userId" )
26
+ private Member userId ;
24
27
25
28
@ Enumerated (EnumType .STRING )
26
29
private Result result ;
Original file line number Diff line number Diff line change 1
1
package com .rhkr8521 .iccas_question .api .member .domain ;
2
2
3
+ import com .rhkr8521 .iccas_question .api .answer .domain .Answer ;
4
+ import com .rhkr8521 .iccas_question .api .result .domain .GameSet ;
3
5
import com .rhkr8521 .iccas_question .common .entity .BaseTimeEntity ;
4
6
import jakarta .persistence .*;
5
7
import lombok .*;
6
8
9
+ import java .util .List ;
10
+
7
11
@ NoArgsConstructor (access = AccessLevel .PROTECTED )
8
12
@ AllArgsConstructor
9
13
@ Getter
@@ -16,4 +20,10 @@ public class Member extends BaseTimeEntity {
16
20
private Long id ;
17
21
18
22
private String userId ;
23
+
24
+ @ OneToMany (mappedBy = "member" , cascade = CascadeType .ALL , orphanRemoval = true )
25
+ private List <GameSet > gameSets ;
26
+
27
+ @ OneToMany (mappedBy = "member" , cascade = CascadeType .ALL , orphanRemoval = true )
28
+ private List <Answer > answers ;
19
29
}
Original file line number Diff line number Diff line change 1
1
package com .rhkr8521 .iccas_question .api .result .domain ;
2
2
3
+ import com .rhkr8521 .iccas_question .api .member .domain .Member ;
3
4
import com .rhkr8521 .iccas_question .common .entity .BaseTimeEntity ;
4
5
import jakarta .persistence .*;
5
6
import lombok .*;
@@ -15,7 +16,10 @@ public class GameSet extends BaseTimeEntity {
15
16
@ GeneratedValue (strategy = GenerationType .IDENTITY )
16
17
private Long id ;
17
18
18
- private String userId ;
19
+ @ ManyToOne (fetch = FetchType .LAZY )
20
+ @ JoinColumn (name = "userId" )
21
+ private Member userId ;
22
+
19
23
private String theme ;
20
24
private int firstStageRecord ;
21
25
private int firstStageTotalCount ;
Original file line number Diff line number Diff line change 1
1
package com .rhkr8521 .iccas_question .api .result .domain ;
2
2
3
+ import com .rhkr8521 .iccas_question .api .member .domain .Member ;
3
4
import com .rhkr8521 .iccas_question .common .entity .BaseTimeEntity ;
4
5
import jakarta .persistence .*;
5
6
import lombok .*;
@@ -15,7 +16,10 @@ public class Result extends BaseTimeEntity {
15
16
@ GeneratedValue (strategy = GenerationType .IDENTITY )
16
17
private Long id ;
17
18
18
- private String userId ;
19
+ @ OneToOne (fetch = FetchType .LAZY )
20
+ @ JoinColumn (name = "userId" )
21
+ private Member userId ;
22
+
19
23
private String theme ;
20
24
private Long stage ;
21
25
private int correctAnswers ;
You can’t perform that action at this time.
0 commit comments