There are two ways to achieve this:
final PageRequest page1 = new PageRequest(
0, 20, Direction.ASC, "lastName", "salary"
);
final PageRequest page2 = new PageRequest(
0, 20, new Sort(
new Order(Direction.ASC, "lastName"),
new Order(Direction.DESC, "salary")
)
);
dao.findAll(page1);
As you can see the second form is more flexible as it allows to define different direction for every property (lastName ASC, salary DESC
).