Reputation: 6767
I'm trying to make this simple JPA query working:
@Query("SELECT p FROM PersonImpl p WHERE p.customerReference LIKE :query ESCAPE '\\\\'")
public Page<Person> findByQuery(@Param("query") String query, Pageable pageable);
But upon application startup I get exception:
java.lang.IllegalArgumentException: Illegal like pattern :query!
at org.springframework.data.jpa.repository.query.StringQuery.getLikeTypeFrom(StringQuery.java:205)
at org.springframework.data.jpa.repository.query.StringQuery.parseLikeBindings(StringQuery.java:155)
When I change the :query param into a string literal, for eg. 'foobar', then it's fine. Does anyone know what's the issue here?
Upvotes: 2
Views: 1767