0

I implemented case insensitive Store search by name/street.

First I wrote:

@Query("select t from Store t where lower(t.name) like lower(concat('%', :query, '%')) or lower(t.street) like lower(concat('%', :query, '%'))")
Page<Store> findAll(@Param("query") String query, Pageable pageable);

Then I just tested the other version and it worked for me.

@Query("select t from Store t where t.name like %:query% or t.street like %:query%")
Page<Store> findAll(@Param("query") String query, Pageable pageable);

Does it mean that Like oparation is case insensitive by default in Spring Data JPA? I read the reference docs, but could not find approve there.

0bj3ct
  • 1,400
  • 4
  • 22
  • 51

0 Answers0