【发布时间】:2011-05-27 14:45:06
【问题描述】:
我正在尝试按在 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;
}
当我这样做时,getter 被正确调用
int votes=objectWithPoints.points;
我觉得我在 siena 上假装有点过头了,但我希望它能够正常工作(或一些类似的代码)。目前它只是跳过订单条件。任何其他字段的排序都可以正常工作。
【问题讨论】:
标签: sql-order-by playframework siena