Skip to content

Commit

Permalink
feat: company-department 연관관계 변경 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
OJOJIN committed Oct 7, 2023
1 parent bfd3c9c commit 7d9fbe5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
import kusitms.server.domain.user.entity.User;
import lombok.*;

import java.util.ArrayList;
import java.util.List;

@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
Expand All @@ -28,8 +31,8 @@ public class Company {
@JoinColumn(name = "user_id")
private User user;

@OneToOne(mappedBy = "company", cascade = CascadeType.ALL, orphanRemoval = true)
private Department department;
@OneToMany(mappedBy = "company", cascade = CascadeType.ALL, orphanRemoval = true)
private List<Department> departments = new ArrayList<>();

@OneToMany(mappedBy = "company", fetch = FetchType.LAZY)
private List<CafeCompany> cafeCompanies = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Department {
@JoinColumn(name = "user_id")
private User user; // 유저 id

@OneToOne(fetch = LAZY, cascade = CascadeType.ALL)
@ManyToOne(fetch = LAZY, cascade = CascadeType.ALL)
@JoinColumn(name = "company_id")
private Company company; // 회사 id

Expand Down

0 comments on commit 7d9fbe5

Please sign in to comment.