Order by 子句不适用于 Play Ebean 中的字符串
Order by clause not working for string in Play Ebean
我想根据字符串对列表进行排序,但 ebean 出现错误。这是我的查询。
ExpressionList<Application> query = find.query()
.where();
query.setFirstRow(start * 10)
.setMaxRows(max);
query.orderBy("applicationVerification.verificationStatus like 'PENDING%' desc");
java.lang.RuntimeException: Expecting [like] to be asc or desc?
at io.ebean.OrderBy.isAscending(OrderBy.java:460)
at io.ebean.OrderBy.parseProperty(OrderBy.java:445)
at io.ebean.OrderBy.parse(OrderBy.java:414)
at io.ebean.OrderBy.<init>(OrderBy.java:58)
Like 运算符用于 WHERE 子句,它不适用于 OrderBy,因此您可以将代码更改为:
query.orderBy("applicationVerification.verificationStatus desc");
或
query.orderBy().desc("applicationVerification.verificationStatus");
有关 eban 网站的更多信息 https://ebean.io/docs/query/orderBy
我想根据字符串对列表进行排序,但 ebean 出现错误。这是我的查询。
ExpressionList<Application> query = find.query()
.where();
query.setFirstRow(start * 10)
.setMaxRows(max);
query.orderBy("applicationVerification.verificationStatus like 'PENDING%' desc");
java.lang.RuntimeException: Expecting [like] to be asc or desc?
at io.ebean.OrderBy.isAscending(OrderBy.java:460)
at io.ebean.OrderBy.parseProperty(OrderBy.java:445)
at io.ebean.OrderBy.parse(OrderBy.java:414)
at io.ebean.OrderBy.<init>(OrderBy.java:58)
Like 运算符用于 WHERE 子句,它不适用于 OrderBy,因此您可以将代码更改为:
query.orderBy("applicationVerification.verificationStatus desc");
或
query.orderBy().desc("applicationVerification.verificationStatus");
有关 eban 网站的更多信息 https://ebean.io/docs/query/orderBy