我对spring data jpa很陌生。我正在尝试在查询数据库时使用规范。我的问题是使用 crudrepository 我们可以像这样:
findTopByUsernameOrderByUpdatedAtDesc(String username);
我怎样才能达到相同的使用规范?我可以做一些基本的事情,比如和或规范,但不像我们可以用标准等做的那样健壮。
Specification<CustomClass> spec = Specifications.where(specification).and(username);
List<CustomClass> list = findAll(spec);