我正在嘗試使用以下方法獲取按屬性“created_at”排序的資料串列。但是 Sort.by() 方法無法讀取屬性名稱,它只能讀取“created”而不是“created_at”。
public List<Invoice> getAllInvoices() {
return repo.findAll(Sort.by("created_at").descending());
}
下面是控制臺訊息:
org.springframework.data.mapping.PropertyReferenceException: No property created found for type Invoice!

uj5u.com熱心網友回復:
這也可能是您的問題:我遇到了同樣的問題,并在這里找到了解決方案:https : //dzone.com/articles/persistence-layer-spring-data
我重命名了一個物體屬性。但是對于 Springs 自動自定義查詢,有一個為舊屬性名稱定義的介面。 https://stackoverflow.com/a/26539097/10832295
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/391909.html
上一篇:尋找方塊圖的脈沖回應
