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?
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 .
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));
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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.