Skip to content

Conversation

@hyerinhwang-sailin
Copy link
Collaborator

@hyerinhwang-sailin hyerinhwang-sailin commented Oct 21, 2025

Related issue 🛠

Work Description ✏️

목적

운영 환경에서 발생한 2가지 오류를 해결합니다.

  1. 정렬 파라미터 오용으로 인한 500 (PropertyReferenceException)
    • 원인: Swagger가 sort=["string"] 같은 값을 전달하면서

      findAllByStampIdOrderByClapCountDescUpdatedAtDesc 메서드 해석 과정에

      잘못된 필드명이 섞여 No property '["string"]' found for type 'Clap' 예외 발생.

    • 조치:

      • 컨트롤러에서 정렬 파라미터를 아예 받지 않고 내부 고정 정렬만 사용.
      • page, size는 쿼리 파라미터로 받고, 유효성 보정(page≥0, 1≤size) 적용.
  2. 네이티브 쿼리에서 스키마 미지정으로 인한 500 (relation "stamp" does not exist)
    • 원인: DB 기본 스키마가 public인 환경에서 UPDATE stamp ... RETURNING 네이티브 쿼리가

      원격 db 스키마를 못 찾아 실패.

    • 조치:

      • StampRepositoryImpl 네이티브 SQL에 스키마 접두어({schema}.stamp)를 적용.

      • application.ymlhibernate.default_schemahikari.connection-init-sql(SET search_path ...)을 설정해

        JPA/Hibernate와 네이티브가 동일 스키마를 보도록 정합성 확보.

변경사항 요약

  • StampController
    • GET /stamps/{stampId}/clappers에서 page, size 직접 파라미터 사용, 값 보정 로직 추가.
    • 외부 정렬 파라미터 미수용 → 레포의 고정 정렬만 사용.
  • StampRepositoryImpl
    • @Value로 스키마 주입 받아 네이티브 UPDATE에 스키마 접두어 적용.
  • application.yml
    • spring.datasource.hikari.connection-init-sqlsearch_path 설정.
  • ClapMilestoneGuard
    • @Value로 스키마 주입 받아 네이티브 INSERT에 스키마 접두어 적용.

Trouble Shooting ⚽️

Related ScreenShot 📷

Uncompleted Tasks 😅

To Reviewers 📢

@hyerinhwang-sailin hyerinhwang-sailin linked an issue Oct 21, 2025 that may be closed by this pull request
1 task
@hyerinhwang-sailin hyerinhwang-sailin self-assigned this Oct 21, 2025
@hyerinhwang-sailin hyerinhwang-sailin added the 🛠️ BugFix 버그 해결 label Oct 21, 2025
@hyerinhwang-sailin hyerinhwang-sailin changed the title [Fix] - #634 [Fix] 스키마 설정 일관화(default_schema + search_path) 및 페이지네이션 안정화 - #634 Oct 21, 2025
@hyerinhwang-sailin hyerinhwang-sailin merged commit e3f2500 into dev Oct 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FIX] 박수 관련 수정

1 participant