Skip to content

Commit

Permalink
[FIX] optional=false하면 lazy load와 같이 동작함
Browse files Browse the repository at this point in the history
  • Loading branch information
wakkpu committed Jan 16, 2024
1 parent bcbf54b commit 57f1418
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Product extends BaseEntity {
@Builder.Default
private Set<ProductStock> productStocks = new TreeSet<>();

@OneToOne(mappedBy = "product", fetch = FetchType.LAZY)
@OneToOne(mappedBy = "product", fetch = FetchType.LAZY, optional = false)
private ReviewAggregate reviewAggregate;

@Enumerated(EnumType.STRING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public Page<Product> findProductPage(Long brandId, List<Category> childCategorie
.from(product)
.leftJoin(product.brand, brand).fetchJoin()
.leftJoin(product.category, category).fetchJoin()
.leftJoin(product.reviewAggregate, reviewAggregate).fetchJoin()
.leftJoin(product.describeImages, describeImage).fetchJoin()
.where(product.deleted.eq(false)
.and(brandIdEq(brandId))
Expand Down Expand Up @@ -127,7 +126,6 @@ public Slice<Product> searchProductsFromOOTD(Long lastId, String query) {
.select(product)
.from(product)
.leftJoin(product.brand, brand).fetchJoin()
.leftJoin(product.reviewAggregate, reviewAggregate).fetchJoin()
.leftJoin(product.productStocks, productStock).fetchJoin()
.where(product.deleted.eq(false)
.and(product.id.gt(lastId))
Expand Down

0 comments on commit 57f1418

Please sign in to comment.