I want to get the whole WHEREclause as a REST parameter and supply it to PagingAndSortingRepository. Is it possible in Spring? I know I can do this with native sql but I also want to use the paging capabilities of spring. I think QueryDsl won't work for me because the where clause is simply limitless and I have to parse all the parameters in that case.
Ex request:
localhost:8080/users?page=0&size=5&where=(firstname+eq+john+and+lastname+neq+terry)or([email protected])
I expect it to be sth like:
interface UserDAO extends PagingAndSortingRepository<User, Integer> {
@Query(value = "SELECT * FROM User ?2",
countQuery = "SELECT count(*) FROM User ?2",
nativeQuery = true)
List<User> getUserList(Pageable pageable, String filter);
}
In a nutshell, I need something to change the filter parameter in the above code with the requested WHERE clause. Any kind of ideas would be greatly appreciated.
Thanks..