I have a JpaRepository
:
public interface PostRepository extends JpaRepository<Entity, Integer>
And I have a default method inside:
Page<Entity> findAllByBookIdAndStatus(Integer bookId, PostStatus postStatus, Pageable pageable);
And the method above doesn't sort my data, just return in no particular order.
So if I want to have my data sorted, can I add some SQL data to this method e.g. ORDER BY ENTITY_ID
and to not write new SQL query?
Is it possible and if yes, how can I do it?