-
Notifications
You must be signed in to change notification settings - Fork 1
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
숙소, 객실, 예약 Entity 설계 #7
Conversation
Accommodation Entity 구현
Room Entity 구현
RoomOrder Entity 구현
RoomOrder Entity 구현
import문 알파벳에 맞게 정렬
Member Entity에 ID 추가
src/main/java/kr/co/fastcampus/yanabada/domain/accommodation/entity/Accommodation.java
Outdated
Show resolved
Hide resolved
private String image; | ||
|
||
private Accommodation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 사이에 숙박 옵션과 룸 리스트를 갖는게 없습니다 규철님!!
`@OneToOne(
fetch = FetchType.LAZY, mappedBy = "accommodation",
cascade = CascadeType.PERSIST, orphanRemoval = true
)
private AccommodationOption accommodationOption;
@OneToMany(
fetch = FetchType.LAZY, mappedBy = "accommodation",
cascade = CascadeType.PERSIST, orphanRemoval = true
)
private final List<Room> rooms = new ArrayList<>();`
다음 코드가 들어가야할 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아직 숙박 옵션이 정해지지 않아서 Entity로 설계를 안해놓았고, 숙소에서 룸 리스트를 가지는 연관관계가 필요 없다고 생각해서 만들지 않았습니다.
- 숙박 옵션이 정해지면, 숙박 옵션 Entity를 설계해서 수정하려고 합니다.
- 숙소에서 룸 리스트를 가지는 연관관계가 꼭 필요할지 의문입니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전 영속성 전이를 사용해서 룸 데이터를 등록할 때 숙박 아이디로 숙박을 찾고 거기에 addRoom 메소드로 숙박에 룸을 넣어두면 나중에 숙박만을 찾아도 룸을 찾게 돼서 좋더라구요! 페치타입은 lazy로 하면 지연호출해서 부를때 가져오기도 하구요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵!!! 룸 데이터를 등록할 때 편리할것 같습니다! 이 부분 연관관계 추가해놓겠습니다~~~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
주현님 혹시 cascade를 ALL이 아닌 PERSIST로만 해놓으신 이유가 있을까요?
ALL로 하면 PERSIST랑 REMOVE도 추가되는데, REMOVE도 있으면 부모가 삭제되면 자식도 삭제되거든요! 숙소가 없는 룸이 없으니깐 ALL로 하는게 더 좋지 않을까요??
src/main/java/kr/co/fastcampus/yanabada/domain/accommodation/entity/Accommodation.java
Show resolved
Hide resolved
src/main/java/kr/co/fastcampus/yanabada/domain/accommodation/entity/Room.java
Show resolved
Hide resolved
src/main/java/kr/co/fastcampus/yanabada/domain/accommodation/entity/enums/Category.java
Show resolved
Hide resolved
src/main/java/kr/co/fastcampus/yanabada/domain/accommodation/entity/enums/City.java
Outdated
Show resolved
Hide resolved
src/main/java/kr/co/fastcampus/yanabada/domain/order/entity/enums/PaymentType.java
Show resolved
Hide resolved
간단하게 리뷰 남겨 보았습니다! 수정 되면 Approve 누르겠습니다! 고생하셨습니다 |
City에서 Region으로 변경
AccommodationOption, RoomOption Entity 구현
숙소 Entity와 룸 Entity사이 연관관계 추가
숙소 옵션, 룸 옵션에 @entity 어노테이션 추가
PaymentType paymentType, | ||
Integer adultCount, | ||
Integer childCount | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
위 필드들에 대한 null 검증 로직이 필요하지 않을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다. 수고하셨습니다.^^
개요
숙소, 객실, 예약 Entity 구현
Resolves: #5
PR 유형
어떤 변경 사항이 있나요?
PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.