Today I’ve released version 2.2.0 of vertx-jooq with the following fixes/changes:
Fix: Codegeneration puts files in wrong folders #5
Fix: Move jooq-codegen dependency to vertx-jooq-generate #4
Enhancement: Create deleteAsync(Condition), fetchOneAsync(Condition) and fetchAsync(Condition)-methods #3
Especially #3 is a nice feature and increases the productivity when working with the auto-generated DAOs. Let’s have a look at the unit-test which tests the new methods:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void asyncCRUDConditionShouldSucceed() throws InterruptedException { | |
CountDownLatch latch = new CountDownLatch(1); | |
CompletableFuture<Integer> insertFuture = dao.insertReturningPrimaryAsync(createSomething()); | |
insertFuture. | |
thenCompose(v -> dao.fetchOneAsync(Tables.SOMETHING.SOMEID.eq(insertFuture.join()))). | |
thenAccept(Assert::assertNotNull). | |
thenCompose(v -> dao.deleteExecAsync(Tables.SOMETHING.SOMEID.eq(insertFuture.join()))). | |
whenComplete(failOrCountDown(latch)); | |
await(latch); | |
} |
You can add any org.jooq.Condition
to fetch (row 6) or delete (row 8) records without having to write the boilerplate SQL on your own – just let vertx-jooq do the work for you.