Reputation: 13492
Here is my issue..
SelectQuery<Record> selectQuery = transRefundFee.selectQuery();
selectQuery.addSelect(AccountBill.ACCOUNT_BILL.BILL_NUMBER,AccountBill.ACCOUNT_BILL.BILL_AMOUNT,AccountBill.ACCOUNT_BILL.TOTAL_PAID );
selectQuery.addFrom(AccountBill.ACCOUNT_BILL);
selectQuery.addConditions(AccountBill.ACCOUNT_BILL.FOLDER_RSN.eq(argFolderRSN));
I have to add the orderby with Case Statement how can we do this i checked Here but its not working in my case any other way I Added like this
selectQuery.addOrderBy( DSL.decode().when(AccountBill.ACCOUNT_BILL.BILL_AMOUNT.le(new BigDecimal(0)),AccountBill.ACCOUNT_BILL.BILL_AMOUNT).then(AccountBill.ACCOUNT_BILL.BILL_AMOUNT) .otherwise(AccountBill.ACCOUNT_BILL.BILL_NUMBER));
But its saying The method then(TableField<AccountBillRecord,BigDecimal>) is undefined for the type CaseConditionStep<BigDecimal>
Same with below code
selectQueryFee.addOrderBy(DSL.decode().when(AccountBill.ACCOUNT_BILL.BILL_AMOUNT.le(new BigDecimal(0))
.then(AccountBill.ACCOUNT_BILL.BILL_AMOUNT)
.otherwise(AccountBill.ACCOUNT_BILL.BILL_NUMBER)));
The method then(TableField) is undefined for the type Condition
Upvotes: 1
Views: 1194
Reputation: 220877
As of jOOQ 3.2, the CASE
expression support does not implement a when()
... then()
structure, i.e. there's no then()
keyword. Instead, write:
DSL.decode()
.when(AccountBill.ACCOUNT_BILL.BILL_AMOUNT.le(new BigDecimal(0)),
AccountBill.ACCOUNT_BILL.BILL_AMOUNT)
.otherwise(AccountBill.ACCOUNT_BILL.BILL_NUMBER)
There has been a pending feature request on the jOOQ roadmap to rectify this: #615
Upvotes: 2