jpa - %Like% Query in spring JpaRepository -
i write query in jparepository not returning '%place%'-its not working 'place' works
here code:
@repository("registeruserrepository") public interface registeruserrepository extends jparepository<registration,long>{ @query("select c registration c c.place like:place") list<registration> findbyplacecontaining(@param("place")string place);}
the spring data jpa query needs "%" chars space char following like
in query, in
@query("select c registration c c.place %:place%")
.
cf. http://docs.spring.io/spring-data/jpa/docs/current/reference/html.
you may want rid of @query
annotation alltogether, seems resemble standard query (automatically implemented spring data proxies); i.e. using single line
list<registration> findbyplacecontaining(string place);
is sufficient.
Comments
Post a Comment