![](/img/trans.png)
[英]Pageable Sorting not working in Spring Data JPA, Spring Framework
[英]Why Jpa sorting is not working with Pageable in Spring?
分頁工作正常,但我無法根據特定字段對數據進行排序。 我的存儲庫方法Page<AdvertSearch> findAll(Pageable pageable);
我的實體 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;
}
我的 postman 請求是: http://localhost:8080/advertsearch/findallbypage?page=0&size=4&sort=district&direction=desc
如您所見,我想根據地區對數據進行排序,但它不起作用。 我的要求錯了嗎? 還是關於 JPA 中的Pageable
?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.