In my app I want to add to my pageable object I want to add order null first for selected attribute. I have followed this advice on stack overflow: How to use Pageable as get-query parameter in spring-data-rest?
Like this:
private Pageable customSort(Pageable pageable) {
Sort sort = pageable.getSort();
Order order = sort.iterator().next();
List<Order> orders = new ArrayList<>();
orders.add(new Order(order.getDirection(),order.getProperty()).nullsFirst());
return PageRequest.of(pageable.getPageNumber(), pageable.getPageSize(), Sort.by(orders));
}
But my problem is that we use SQL Server database which does not support nulls first sorting. (as you can see here: TSQL ORDER BY with nulls first or last (at bottom or top))
Is there any workaround how to modify pageable request for SQL Server database?