Order By Date ASC with Spring Data

前端 未结 4 1399
无人及你
无人及你 2021-02-06 21:10

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         


        
4条回答
  •  长发绾君心
    2021-02-06 21:37

    Example :

    databaseDAO.findByUserNameOrderByCreatedDateDesc(username);
    

    to list out users based on username and sortby created date.

    @Repository
    public interface DatabaseDAO extends JpaRepository {
    
    public List  findByUserNameOrderByCreatedDateDesc(String username);
    
    
    }
    

提交回复
热议问题