So I have next situation:
@Query(value = "SELECT t FROM Ticket t WHERE ?2 like %?1%")
Page<Ticket> searchBy(String keyword,String property,Pageable pageable);
It's don't search for anything. But like this:
@Query(value = "SELECT t FROM Ticket t WHERE t.name LIKE %?1%")
Page<Ticket> searchBy(String keyword, String property, Pageable pageable);
work.
It should work like this: the client sends me a keyword and a field to search for, but the field cannot be dynamically used, then it does not search for anything. Can I insert a property dynamically?
CodePudding user response:
I'm afraid @Query
doesn't allow dynamic query in any reasonable way.