Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete different updatable records in one shot?

How to delete List of different tablerecords from a single query in JOOQ? Is this possible with JOOQ API? Or i have to delete record one by one ,Just get one record fire query and so on?

For Ex: I have two records of different tables Like :

MyTableRecord1 and MyTableRecord2

I want to delete List of records from these two tables in a single call.

like image 506
jaideep Avatar asked Jan 22 '26 14:01

jaideep


1 Answers

Yes, use DSLContext.batchDelete()

DSL.using(configuration)
   .batchDelete(record1, record2)
   .execute();

It'll generate JDBC batch statements for "similar" delete statements. If you're deleting from two tables, one record each, this will just generate two different delete statements.

like image 55
Lukas Eder Avatar answered Jan 25 '26 03:01

Lukas Eder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!