Springboot find items by title then sort order by date

Solution 1:

The problem is type of date private LocalDate creation;

Use the following code :

@Query("SELECT p FROM Post p WHERE p.title=:title 
        ORDER BY DATE(p.localDate) ASC, TIME(p.localTime) ASC")
List<Post> findByTitle(@Param("title") String title);