[英]jOOQ Update query with Where clause
How to add Where
clause with Update query in jOOQ? 如何在jOOQ中使用Update查询添加
Where
子句?
AccountPaymentRecord aacntPaymentRec = new AccountPaymentRecord();
aacntPaymentRec.setReceiptNumber(PaymentNumberFrom);
aacntPaymentRec.setPaymentComment(ReasonFrom);
transfeeTransfer.update(aacntPaymentRec);
I have to add Where
clause as well. 我还必须添加
Where
子句。 How to do it? 怎么做?
Since you're operating on UpdatableRecord
, you might want to follow what's documented here, in the manual . 由于您在
UpdatableRecord
操作,因此您可能需要按照手册中此处记录的内容进行操作 。 Another place to look for information are the jOOQ manual's sections about the UPDATE
statement . 查找信息的另一个地方是jOOQ手册中有关
UPDATE
语句的部分 。
With the code from which you have started, one possible solution would be to use DSLContext.executeUpdate(R, Condition)
: 使用您从中开始的代码,一种可能的解决方案是使用
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 谢谢@Lukas在我的情况下,我必须像这样使用
AccountPaymentRecord aacntPaymentRec = transfeeTransfer.fetchOne(AccountPayment.ACCOUNT_PAYMENT,
AccountPayment.ACCOUNT_PAYMENT.PAYMENT_NUMBER.eq(PaymentNumberTo));
aacntPaymentRec.setReceiptNumber(PaymentNumberFrom);
aacntPaymentRec.setPaymentComment(ReasonFrom);
aacntPaymentRec.update();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.