while sending parameters to @Query function if i give like ?1 it is trying to excute like ? only

Tags: , ,



when i try send:-

@Query(value = "SELECT * FROM  labels where personal_ic_id=?1 and content like '%2%'",nativeQuery = true)
List<Labels> searchByLabels(String personalIcId, String key);

it has been executing like:-

SELECT * FROM  labels where personal_ic_id=? and content like '%?2%'

Answer

remove single inverted comma from like option

Use below

@Query(value = "SELECT * FROM  labels where personal_ic_id=?1 and content like %?2%",nativeQuery = true)


Source: stackoverflow