[英]Why Jpa sorting is not working with Pageable in Spring?
Paging is working good but I cannot sort the data according to a specific field.分页工作正常,但我无法根据特定字段对数据进行排序。 My repository method Page<AdvertSearch> findAll(Pageable pageable);
我的存储库方法Page<AdvertSearch> findAll(Pageable pageable);
My entity class is:我的实体 class 是:
public class AdvertSearch {
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Column(name = "id", nullable = false, columnDefinition = "VARCHAR(36)")
private String id;
private String advertId;
private String officeId;
private String officeName;
//TODO: type hangi Point olacak hangi class olacak karar verilecek
@Column(nullable = false, columnDefinition = "POINT SRID 4326")
private Point location;
private OfficeType officeType;
private String city;
private String district;
private String mainOfficeId;
private Integer facilityCount;
private Integer virtualPackageCount;
private BuildingType buildingType;
private Integer securityCount;
private Double monthlyPrice;
private String currency;
private Integer capacity;
//TODO: officelerde rating olmayacak diye konustuk bunun da netlestirilmesi gerek
private Double rating;
private Integer ratingCount;
}
My postman request is: http://localhost:8080/advertsearch/findallbypage?page=0&size=4&sort=district&direction=desc
我的 postman 请求是: http://localhost:8080/advertsearch/findallbypage?page=0&size=4&sort=district&direction=desc
As you see I want to sort the data according to district but it is not working.如您所见,我想根据地区对数据进行排序,但它不起作用。 Is my request wrong?我的要求错了吗? Or is it about Pageable
in JPA?还是关于 JPA 中的Pageable
?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.