E
E
Eugenue Cesarevich2021-05-14 21:25:11
Spring
Eugenue Cesarevich, 2021-05-14 21:25:11

Is it possible to create a Pageable to sort by nested property?

I have a Cat entity that contains a Kitty entity . Kitty in turn contains a name field .

Now I want to create a Pageable to sort the cats. And I want to sort them by the name of their kittens.

Would a Pageable like this work:

PageRequest.of(pageNum, pageSize, direction, "kitty.name");

?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question