File tree Expand file tree Collapse file tree
src/main/java/fitfit/domain/clothes/mapping Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package fitfit .domain .clothes .mapping ;
22
3- public class WearRoom {
3+ import fitfit .domain .clothes .entity .Clothes ;
4+ import fitfit .domain .member .entity .Member ;
5+ import fitfit .global .entity .BaseEntity ;
6+ import jakarta .persistence .*;
7+ import lombok .*;
8+ import org .springframework .data .annotation .CreatedDate ;
9+ import org .springframework .data .jpa .domain .support .AuditingEntityListener ;
10+
11+ import java .time .LocalDate ;
12+
13+ @ Getter
14+ @ NoArgsConstructor (access = AccessLevel .PROTECTED )
15+ @ AllArgsConstructor
16+ @ Builder
17+ @ Entity
18+ @ Table (name = "WEAR_ROOM" ,
19+ // (회원ID, 옷ID) 쌍 중복되지 않도록 제약 조건
20+ uniqueConstraints = {
21+ @ UniqueConstraint (
22+ name = "WEAR_ROOM_MEMBER_CLOTHES_UK" ,
23+ columnNames = {"member_id" , "clothes_id" }
24+ )
25+ }
26+ )
27+ public class WearRoom extends BaseEntity {
28+
29+ @ Id
30+ @ GeneratedValue (strategy = GenerationType .IDENTITY )
31+ @ Column (name = "wear_room_id" )
32+ private Long id ;
33+
34+ @ ManyToOne (fetch = FetchType .LAZY )
35+ @ JoinColumn (name = "member_id" , nullable = false )
36+ private Member member ;
37+
38+ @ ManyToOne (fetch = FetchType .LAZY )
39+ @ JoinColumn (name = "clothes_id" , nullable = false )
40+ private Clothes clothes ;
441}
You can’t perform that action at this time.
0 commit comments