Conversation
kih1015
approved these changes
Nov 21, 2025
Comment on lines
+13
to
+17
| @Entity | ||
| @Immutable | ||
| @Getter | ||
| @Table(name = "vw_album_photos") | ||
| public class AlbumPhotoView { |
Contributor
There was a problem hiding this comment.
C
뷰테이블을 만들어서 맵핑하는 전략을 선택하셨군요. 이러면 DB가 바뀐다면 뷰테이블도 추가해줘야하는 불편함이 있을 것 같긴합니다.
Comment on lines
+46
to
+58
| public Double getLatitude() { | ||
| if (Objects.isNull(location)) { | ||
| return null; | ||
| } | ||
| return location.getX(); | ||
| } | ||
|
|
||
| public Double getLongitude() { | ||
| if (Objects.isNull(location)) { | ||
| return null; | ||
| } | ||
| return location.getY(); | ||
| } |
Comment on lines
+59
to
+60
|
|
||
| } |
Comment on lines
+21
to
+29
| public class PhotoItem { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| private Long id; | ||
|
|
||
| @Column(name = "photo_id", nullable = false) | ||
| private Long photoId; | ||
|
|
||
| } |
Comment on lines
+45
to
+47
| @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) | ||
| @JoinColumn(name = "album_id") | ||
| private List<PhotoItem> items = new ArrayList<>(); |
Contributor
There was a problem hiding this comment.
R
성능상의 이슈로 인해 어쩔 수 없이 양방향 연관관계로 사용하는 것이 좋을 것 같습니다.. 내부에서는 양방향으로 사용하되, 외부에 PhotoItem을 숨기는 전략이 차선책일 것 같아요.
Collaborator
Author
There was a problem hiding this comment.
PhotoItem 클래스에서 photoId 대신 다대일 양방향(@manytoone) 관계를 사용하여 Photo 객체를 참조하자는 의미일까요?
Contributor
There was a problem hiding this comment.
넵 연관관계의 주인은 참조키를 가지고 있는 엔티티가 되어야 성능 상 이슈가 없다고 하네요..
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.
📌 ISSUE 번호
📄 작업 내용 요약
앨범 내 사진 조회 API
Album도메인과Photo도메인을 각각 불러온 후, 조회 데이터를 가져오는 것은 너무 번거롭다고 생각View를 생성하고, 해당View에 해당하는 도메인 모델을 설계하고, 이를 통해 조회 데이터를 한 번에 가져올 수 있도록 함📢 참고 사항
✅ 체크리스트