当我使用Record13或更多时,orderBy()方法显示错误
orderBy(org.jooq.SortField<T1>) in SelectOrderByStep cannot be applied to
orderBy(org.jooq.SortField<java.sql.Timestamp>)
使用Record12或更低版本,一切正常。
Record14的代码,错误:
public Result<Record14<Integer, Timestamp, OperationType, Integer, Integer, String, String, String,
Integer, String, String, Integer, String, String>> getOperationsHistory(int ownerId, Timestamp fromDate, Timestamp toDate, Integer outletId, Integer merchantId){
Condition condition = OPERATION.TIMESTAMPEVENT.between(fromDate, toDate)
.and(OUTLET.OWNERID.eq(ownerId));
if (outletId != null) {
condition = condition.and(OPERATION.OUTLETID.eq(outletId));
}
if (merchantId != null) {
condition = condition.and(OPERATION.MERCHANTID.eq(merchantId));
}
Select<Record14<Integer, Timestamp, OperationType, Integer, Integer,
String, String, String, Integer, String, String, Integer, String, String>> select =
db.select(OPERATION.ID, OPERATION.TIMESTAMPEVENT, OPERATION.TYPE, OPERATION.AMOUNT, OPERATION.CREDITS, MERCHANT.NAME,
CLIENT.PHONE, CLIENT.PUBLICID, CLIENT.ID, CLIENT.NAME, CLIENT.AVATARURL, RECEIPT.PRINTEDNO, OFFER.TITLE, OFFER.TYPE)
.from(OPERATION.leftOuterJoin(CLIENT).on(OPERATION.CLIENTID.eq(CLIENT.ID))
.leftOuterJoin(MERCHANT).on(OPERATION.MERCHANTID.eq(MERCHANT.ID))
.leftOuterJoin(OUTLET).on(OPERATION.OUTLETID.eq(OUTLET.ID))
.leftOuterJoin(RECEIPT).on(OPERATION.RECEIPTID.eq(RECEIPT.ID))
.leftOuterJoin(OFFER).on(OPERATION.OFFERID.eq(OFFER.ID)))
.where(condition).orderBy(OPERATION.TIMESTAMPEVENT.desc());
return select.fetch();
}
如何解决这个问题?
答案 0 :(得分:1)
根据您的评论,我认为您没有使用最新版本的JDK:1.8.0_45。在最近的过程中,Java编译器中出现了很多错误修复。 The latest release of the Oracle JDK is version 1.8.0_60
jOOQ大量使用:
在Java 8中,类型推断已被大幅修改以支持lambda表达式和generalized target-type inference。这些修改是早期JDK 8版本中出现错误的原因。
我建议升级。