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 @queryannotation alltogether, seems resemble standard query (automatically implemented spring data proxies); i.e. using single line

list<registration> findbyplacecontaining(string place); 

is sufficient.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -