티스토리 뷰

카테고리 없음

JPA LIKE Query

실전압축코딩 2022. 4. 10. 01:57

 

더보기

like 'TEXT'

@Query("Select * from table t where t.column like :query")

 List<User> findByUsernameLike(String username);

 

 

더보기

like '%TEXT'

@Query("Select * from table t where t.column like %:query")

 List<User> findByUsernameStartingWith(String username);

 

 

더보기

like '%TEXT%'

@Query("Select * from table t where t.column like %:query%")

 List<User> findByUsernameContaining(String username);

 

 

더보기

like 'TEXT%'

@Query("Select * from table t where t.column like :query%")

 List<User> findByUsernameEndingWith(String username);