How do I make findByIn search using IgnoreCase of <Field>
?
I tried to use findByNameIgnoreCaseIn
and findByNameInIgnoreCase
with no result.
DB is Postgresql.
@Repository
public interface UserRepository {
List<User> findByNameIgnoreCaseIn(List<String> userNames);
}
IgnoreCase for Case Insensitive Queries Now, suppose we want to perform a case-insensitive search to find all passengers with a given firstName. Here, the IgnoreCase keyword ensures that the query matches are case insensitive.
CrudRepository provides CRUD functions. PagingAndSortingRepository provides methods to do pagination and sort records. JpaRepository provides JPA related methods such as flushing the persistence context and delete records in a batch.
Case Sensitivity. Queries are case-insensitive, except for names of Java classes and properties.
Spring Data JPA aims to significantly improve the implementation of data access layers by reducing the effort to the amount that's actually needed. As a developer you write your repository interfaces, including custom finder methods, and Spring will provide the implementation automatically.
Try something like this:
List<User> findByNameInIgnoreCase(List<String> userNames);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With