0
我試圖得到一個查詢返回的順序在Play中計算的字段。 這是我正在使用的查詢。錫納有可能通過計算字段進行訂購嗎?
return all().order("points").fetch();
其中點被定義爲
public Integer points;
,並取得得益於此getter
public int getPoints(){
List<EventVote> votesP = votes.filter("isPositive", true).fetch();
List<EventVote> votesN = votes.filter("isPositive", false).fetch();
this.points= votesP.size()-votesN.size();
return this.points;
}
吸氣劑正確調用,當我做
int votes=objectWithPoints.points;
我有感覺我是假裝從錫耶納有點太多,但我會喜歡這個工作(或一些類似的代碼)。目前它只是跳過訂單條件。在任何其他領域訂購都能正常工作。