1

How to add Where clause with Update query in jOOQ?

AccountPaymentRecord aacntPaymentRec = new AccountPaymentRecord();
aacntPaymentRec.setReceiptNumber(PaymentNumberFrom);
aacntPaymentRec.setPaymentComment(ReasonFrom);
transfeeTransfer.update(aacntPaymentRec);

I have to add Where clause as well. How to do it?

4

2 回答 2

1

Since you're operating on UpdatableRecord, you might want to follow what's documented here, in the manual. Another place to look for information are the jOOQ manual's sections about the UPDATE statement.

A possible solution for you:

With the code from which you have started, one possible solution would be to use DSLContext.executeUpdate(R, Condition):

AccountPaymentRecord aacntPaymentRec = new AccountPaymentRecord();
aacntPaymentRec.setReceiptNumber(PaymentNumberFrom);
aacntPaymentRec.setPaymentComment(ReasonFrom);
DSL.using(configuration)
   .executeUpdate(aacntPaymentRec, ACCOUNT_PAYMENT.ID.eq(123));
于 2013-10-30T09:11:26.253 回答
1

Thanks @Lukas in my case i have to use like this

AccountPaymentRecord aacntPaymentRec = transfeeTransfer.fetchOne(AccountPayment.ACCOUNT_PAYMENT,
                AccountPayment.ACCOUNT_PAYMENT.PAYMENT_NUMBER.eq(PaymentNumberTo));
aacntPaymentRec.setReceiptNumber(PaymentNumberFrom);
aacntPaymentRec.setPaymentComment(ReasonFrom);
aacntPaymentRec.update();
于 2013-10-30T09:29:34.660 回答