Spring @Query with bottom and wildcards
This question is about Spring Data JPA.
I need (native) @Query with bottom function and wildcards. But I'm not going to work.
Here's a simplified version of what I'm looking for:
@Query(value = "SELECT * FROM CAR c WHERE LOWER(c.model) LIKE LOWER(%:model%)", nativeQuery = true)
List<Car> findByModelMatching( @Param("model") String model );
LOWER (%: model%) -> not working! LOWER (: model) -> works!
I know that a query like this can be easily rewritten as:
List<Car> findByModelContainingIgnoreCase( String model );
But I'm not looking for a Named Query.
My question is how to combine LOWER (or even UPPER) with WildCards in @Query!
Greetings
+3
source to share