I am using spring data jpa and JQGrid. I need response based on multiple sort parameters. I tried using sort parameter=column a,column b and sort order=asc but I am getting an exception
:No property column a,column b found in pojo.
It works if I would pass either of one columns as sort parameter. Code:
Pageable pageable = JPAUtility.constructPageSpecification(pageNumber, rowsPerPage, sortColName, sortOrder);
How can I pass multiple column names in sortColName
parameter?
In Spring Data you just need to add Sort parameter into findBy* method. Sort object has got a couple constructors, e.g.
Sort(Direction direction, String... properties)
which is probably exactly what you need. If you need to specify different directions for various properties then you can use
Sort(Order... orders)
where Order has property and direction: Order(Direction direction, String property)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With