Skip to content
Advertisement

Order By Date ASC with Spring Data

I try to make an application with Spring-Data-JPA on a table in order by ASC but it gives me an error:

Invalid derived query! No property asc found for type java.util.Calendar

Why ?

List<Foo> findAllOrderByDateAsc();

or

@Query("SELECT * FROM foo ORDER BY date ASC")
List<Foo> findAllOrderByDateAsc();

Advertisement

Answer

Try to add “By” between “All” and “Order” like this:

List<Foo> findAllByOrderByDateAsc();
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement