[4기 전선희] Mission 3 PR 제출합니다!#288
Open
funnysunny08 wants to merge 2 commits intoprgrms-be-devcourse:funnysunny08-mission03from
Open
[4기 전선희] Mission 3 PR 제출합니다!#288funnysunny08 wants to merge 2 commits intoprgrms-be-devcourse:funnysunny08-mission03from
funnysunny08 wants to merge 2 commits intoprgrms-be-devcourse:funnysunny08-mission03from
Conversation
JoosungKwon
reviewed
Jul 30, 2023
Member
JoosungKwon
left a comment
There was a problem hiding this comment.
선희님 3번째 과제까지 고생하셨습니다~~ 👍👍 간단한 리뷰 남겼습니다! 참고해주세요~
p.s 연관 관계에 대한 다이어그램까지 있다면 좋을 것 같아요~~ 😄
| @Column(nullable = false) | ||
| private String lastName; | ||
|
|
||
| @OneToMany(mappedBy = "customer", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) |
Comment on lines
+21
to
+23
| customer.setId(1L); | ||
| customer.setFirstName("honggu"); | ||
| customer.setLastName("Kang"); |
Member
There was a problem hiding this comment.
Setter가 어디서 선언된거죠..😂 Setter보다 생성자를 활용하면 좋을 것 같아요~
|
|
||
| // Then | ||
| Customer entity = repository.findById(1L).get(); | ||
| log.info("{} {}", entity.getLastName(), entity.getFirstName()); |
Member
There was a problem hiding this comment.
log를 남기기 보다 값을 검증해보면 좋을 것 같아요!
| private Long id; | ||
|
|
||
| @Column(name = "memo", nullable = true) | ||
| @Setter |
Member
There was a problem hiding this comment.
Setter 보다 의미있는 메서드를 사용하는게 좋다는 거 아시죠~?
| @Column(name = "order_date_time", columnDefinition = "TIMESTAMP", nullable = false) | ||
| private LocalDateTime orderDateTime; | ||
|
|
||
| @ManyToOne(fetch = FetchType.EAGER) |
Member
There was a problem hiding this comment.
FetchType에 대해 잘 알고 계신가요? EAGER로 하신 이유가 궁금합니다
| private Customer customer; | ||
|
|
||
| @OneToMany(mappedBy = "order", fetch = FetchType.LAZY, cascade = CascadeType.ALL, orphanRemoval = true) | ||
| private List<OrderItem> orderItems; |
Comment on lines
+34
to
+44
| setOrderItem(orderItem); | ||
| } | ||
|
|
||
| private void setOrderItem(OrderItem orderItem) { | ||
| if (Objects.nonNull(this.orderItem)) { | ||
| this.orderItem.getItems().remove(this); | ||
| } | ||
|
|
||
| this.orderItem = orderItem; | ||
| orderItem.getItems().add(this); | ||
| } |
Member
There was a problem hiding this comment.
어떤 의도를 가지고 private으로 두고 생성자에서 추가하는 방식을 선택하셨는지 궁금합니다~
| @Entity | ||
| @Table(name = "items") | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class Item { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📌 과제 설명
springboot-jpa mission 3 구현
👩💻 요구 사항과 구현 내용