I would like to write a like query in JpaRepository
but it is not returning anything :
LIKE \'%place%\'
-its not working.
LIKE
For your case, you can directly use JPA methods. That is like bellow :
Containing: select ... like %:place%
List findByPlaceContainingIgnoreCase(String place);
here, IgnoreCase will help you to search item with ignoring the case.
Using @Query in JPQL :
@Query("Select registration from Registration registration where
registration.place LIKE %?1%")
List findByPlaceContainingIgnoreCase(String place);
Here are some related methods:
Like findByPlaceLike
… where x.place like ?1
StartingWith findByPlaceStartingWith
… where x.place like ?1 (parameter bound with appended %)
EndingWith findByPlaceEndingWith
… where x.place like ?1 (parameter bound with prepended %)
Containing findByPlaceContaining
… where x.place like ?1 (parameter bound wrapped in %)
More info , view this link , this link and this
Hope this will help you :)