Conversation
WalkthroughItemRepository queries were updated to replace entity-based JPQL references with concrete table/column names: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
src/main/java/com/salemale/domain/item/repository/ItemRepository.java (3)
116-138: Critical: JPQL query using native SQL column/table names will fail at runtime.This is a JPQL query (no
nativeQuery = true), but it references native SQL identifiers (i.seller_id,block_list,bl.blocker_id,bl.blocked_user_id). JPQL requires entity field names, not database column names.Apply this diff to use proper JPQL syntax:
@Query(""" SELECT i FROM Item i WHERE i.itemType = com.salemale.global.common.enums.ItemType.AUCTION AND i.itemStatus = :status AND ( - :me IS NULL OR i.seller_id NOT IN ( - SELECT bl.blocked_user_id - FROM block_list bl - WHERE bl.blocker_id = :me + :me IS NULL OR i.seller.id NOT IN ( + SELECT bl.blocked.id + FROM BlockList bl + WHERE bl.blocker.id = :me ) ) AND ( LOWER(i.title) LIKE LOWER(CONCAT('%', :keyword, '%')) OR LOWER(i.name) LIKE LOWER(CONCAT('%', :keyword, '%')) ) ORDER BY i.createdAt DESC """)Note: Verify the exact field names in
BlockListentity (e.g.,blocked,blocker) match your entity definition.
146-181: Critical: Same JPQL/native SQL mismatch issue.This JPQL query also incorrectly uses native SQL column/table names.
Apply this diff:
@Query(""" SELECT i FROM Item i WHERE i.itemType = com.salemale.global.common.enums.ItemType.AUCTION AND i.itemStatus = :status AND ( - :me IS NULL OR i.seller_id NOT IN ( - SELECT bl.blocked_user_id - FROM block_list bl - WHERE bl.blocker_id = :me + :me IS NULL OR i.seller.id NOT IN ( + SELECT bl.blocked.id + FROM BlockList bl + WHERE bl.blocker.id = :me ) )
189-219: Critical: Same JPQL/native SQL mismatch issue.This JPQL query also incorrectly uses native SQL column/table names.
Apply this diff:
@Query(""" SELECT i FROM Item i WHERE i.itemType = com.salemale.global.common.enums.ItemType.AUCTION AND i.itemStatus = :status AND ( - :me IS NULL OR i.seller_id NOT IN ( - SELECT bl.blocked_user_id - FROM block_list bl - WHERE bl.blocker_id = :me + :me IS NULL OR i.seller.id NOT IN ( + SELECT bl.blocked.id + FROM BlockList bl + WHERE bl.blocker.id = :me ) )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/salemale/domain/item/repository/ItemRepository.java(7 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (2)
src/main/java/com/salemale/domain/item/repository/ItemRepository.java (2)
63-68: LGTM!Native SQL queries correctly use database column names (
seller_id,blocked_user_id,blocker_id) and table name (block_list). This is the appropriate syntax fornativeQuery = true.Also applies to: 87-92
231-236: LGTM!Native SQL syntax is correctly applied for this native query.
src/main/java/com/salemale/domain/item/repository/ItemRepository.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (2)
src/main/java/com/salemale/domain/item/repository/ItemRepository.java (2)
151-156: Critical: JPQL query uses SQL column names instead of entity properties.This JPQL query incorrectly uses SQL column names (
i.seller_id,block_list,bl.blocker_id,bl.blocked_user_id) instead of entity property navigation, which will cause a runtime error.Apply this diff to use correct JPQL entity navigation:
AND ( - :me IS NULL OR i.seller_id NOT IN ( - SELECT bl.blocked_user_id - FROM block_list bl - WHERE bl.blocker_id = :me + :me IS NULL OR i.seller.id NOT IN ( + SELECT bl.blocked.id + FROM BlockList bl + WHERE bl.blocker.id = :me ) )Note: Adjust
bl.blocked.idto match yourBlockListentity's property name for the blocked user.
194-199: Critical: JPQL query uses SQL column names instead of entity properties.This JPQL query incorrectly uses SQL column names instead of entity property navigation, which will cause a
QuerySyntaxExceptionat runtime.Apply this diff to use correct JPQL entity navigation:
AND ( - :me IS NULL OR i.seller_id NOT IN ( - SELECT bl.blocked_user_id - FROM block_list bl - WHERE bl.blocker_id = :me + :me IS NULL OR i.seller.id NOT IN ( + SELECT bl.blocked.id + FROM BlockList bl + WHERE bl.blocker.id = :me ) )Note: Adjust
bl.blocked.idto match yourBlockListentity's property name for the blocked user.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/java/com/salemale/domain/item/repository/ItemRepository.java(8 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (2)
src/main/java/com/salemale/domain/item/repository/ItemRepository.java (2)
63-68: LGTM! Native SQL syntax is correct.The block-list subquery correctly uses table and column names (
block_list,blocker_id,blocked_user_id) appropriate for native SQL.Also applies to: 87-92
231-236: LGTM! Native SQL syntax is correct.The block-list subquery correctly uses table and column names appropriate for native SQL. The previously reported typo on line 264 appears to have been resolved.
Also applies to: 259-264
🎋 이슈 및 작업중인 브랜치
#144

#140 에서 추가한 itemrepository 내 쿼리문 컬럼 이름 이슈로 검색 시 에러발생하여 수정
🔑 주요 내용
Check List
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.