JPA - Null 컬럼 조회

킹콩(King Kong)·2025년 1월 14일

findBy() 함수 사용시 속성이 NULL 이 있을때 검색 안됨

  • findByNameContainsIgnoreCaseAndDescriptionContainsIgnoreCase(String name, String description)

  • description 속성에 NULL 이 들어 있으면 검색이 Name속성과 description은 NULL이 아닌 컬럼만 검색이 됨 (NULL도 다 검색되게 하고 싶은데 안됨)

  • 즉, field1 -> 'TEST; field2 - null 이면 검색이 안되고,

  • field1 -> 'TEST'; field2 - '' 이면 잘 겁색 됨

해결책

  • IncludeNull
profile
IT를 쉽게 이해해 보아요~😄

0개의 댓글