Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4기 김영주, 소재훈] JPA Mission 3 - 연관관계매핑(order, order_item, item의 연관관계 매핑 실습) #326

Open
wants to merge 11 commits into
base: 영주,재훈-mission
Choose a base branch
from

Conversation

jay-so
Copy link
Member

@jay-so jay-so commented Aug 3, 2023

👩‍💻 요구 사항과 구현 내용

order, order_item, item의 연관관계 매핑 실습

  • Member와 Order의 1:N의 양방향의 연관관계
  • Order와 OrderItem의 1:N의 양방향의 연관관계 매핑
  • Member CRUD 구현

@jay-so jay-so requested review from charlesuu and Hchanghyeon August 3, 2023 16:13
@jay-so jay-so marked this pull request as ready for review August 3, 2023 16:13
Copy link
Member

@Hchanghyeon Hchanghyeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

영주님, 재훈님~ 너무 깔끔하게 잘해주셔서 리뷰할게 많지 않았던 것 같아요!

리뷰 달아놓았으니 확인 한 번만 부탁드리겠습니다! 🙏🙏🙏

감사합니다~!

Comment on lines +32 to +37
public ResponseDto findById(Long id) {
Member member = memberRepository.findById(id)
.orElseThrow(() -> new NoSuchElementException("해당 고객이 존재하지 않습니다."));

return ResponseDto.fromEntity(member);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 조회 메소드 들에 대해서는 따로 @Transactional(readOnly = true)를 적어주시지 않았는데 따로 이유가 있으실까요?

제가 알기로는 find해서 가져오는 것에는 문제가 없으나 OSIV를 끄고 Member안에 있는 다른 객체의 값을 가져올 때 Lazy Loading이 되지않아 정상적인 동작을 할 수 없는 경우도 있다고 보았습니다!

참고 사항

package com.programmers.springbootjpa.entity;

public enum OrderStatus {
ACCEPTED, CANCELED, DELIVERED
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문자열 상수로만 이루어져있다해도 한 칸씩 개행해주는 것이 더 가독성에 좋을 것 같다고 생각이 드는데 어떻게 생각하시나요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants