I am using JOOQ ( 3.10. 5 ) to update records in ORACLE table without jooq auto code generation in below ways
Approach 1- Using DSL execute by using plain SQL String
dslContext.execute("update author set first_name = 'updateTest-111111' where id = 1 ");
logger.info("1st update Done ");
dslContext.execute("update author set first_name = 'updateTest-2222222' where id = 2 ");
logger.info("2nd update Done ");
Approach 2 - Using DSL batch by passing Query list
List<Query> updateQueries = new ArrayList<>();
updateQueries.add(dslContext.parser().parseQuery("update author set first_name = 'updateTest-111' where id = 1 "));
updateQueries.add(dslContext.parser().parseQuery("update author set first_name = 'updateTest-222' where id = 2 "));
dslContext.batch(updateQueries).execute();
But in both cases, it is just updating 1st record and then stop execution , keeps on running.
Below is the output for Approach -1
2022-05-13 02:43:50.848 INFO 25524 --- [nio-9010-exec-1] org.jooq.Constants :
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@ @@ @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@
@@@@@@@@@@@@@@@@ @@ @@ @@@@@@@@@@
@@@@@@@@@@ @@@@ @@ @@ @@@@@@@@@@
@@@@@@@@@@ @@ @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@ @@ @@@@@@@@@@
@@@@@@@@@@ @@ @@ @@@@ @@@@@@@@@@
@@@@@@@@@@ @@ @@ @@@@ @@@@@@@@@@
@@@@@@@@@@ @@ @ @ @@@@@@@@@@
@@@@@@@@@@ @@ @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Thank you for using jOOQ 3.10.5
2022-05-13 02:43:50.922 WARN 25524 --- [nio-9010-exec-1] o.a.tomcat.jdbc.pool.ConnectionPool : minIdle is larger than maxActive, setting minIdle to: 5
2022-05-13 02:43:50.923 WARN 25524 --- [nio-9010-exec-1] o.a.tomcat.jdbc.pool.ConnectionPool : maxIdle is larger than maxActive, setting maxIdle to: 5
2022-05-13 02:43:52.670 INFO 25524 --- [nio-9010-exec-1] c.d.e.dao.ECRebootServiceDaoImpl : 1st update Done
As you can see it stopped after 1st update Done.
How i should be executing multiple update queries using JOOQ ? or is there any better way to do this in JOOQ without code generation?