I\'d like to write a query like this
@Query(\"select p from Product p where p.name = ?1 or p.desc like %?1%\")
but it gives me the exceptio
If you are using Spring Data JPA version 1.3.1 or later you need to do the following:
@Query("select p from Product p where p.name = :name or p.desc like %:name%")
public List searchByName(@Param("name") String name);
Check out this blog post for more details
Prior to Spring Data JPA 1.3.1, you could not use %
in the @Query annotation, but instead you needed to add it in the argument itself