Skip to content

Commit

Permalink
Merge pull request #72 from SW-Marastro/KKUMI-113/feature/#66/refacto…
Browse files Browse the repository at this point in the history
…ring_post_read

KKUMI-113 [FIX] #66 lazy 로딩으로 설정된 데이터 미리 로딩
  • Loading branch information
eekrwl authored Oct 2, 2024
2 parents ede8780 + 2b32f74 commit 078ea6d
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import jakarta.transaction.Transactional;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.Hibernate;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -99,6 +100,9 @@ public Long registerPost(User user, Long subCategoryId, String content, List<Pos
Post post = Post.of(postContentObjects, user, subCategory, postImages);
Post savedPost = postRepository.save(post); //mysql 저장 완료

Hibernate.initialize(post.getSubCategory());
Hibernate.initialize(post.getSubCategory().getCategory());

eventPublisher.publishEvent(new PostCreatedEvent(post, subCategory.getCategory(), user, images));

saveHashtags(contentTexts, savedPost);
Expand Down

0 comments on commit 078ea6d

Please sign in to comment.