spring-data-jpa模糊查询
记录一条关于spring-data-jpa模糊查询的语句
方法一:
@Query(value="select * from search_key a where a.key_name like CONCAT('%',:keyName,'%') ",nativeQuery=true) List<SearchKey> findByKeyNameLimit(@Param("keyName") String keyName);
方法二:
@Query(value="select * from search_key a where a.key_name like CONCAT('%',?1,'%') limit 1",nativeQuery=true) List<SearchKey> findByKeyNameLimit(String keyName);