solved it. There was a silly mistake in a code. while creating DSLContext
transactionContext
I was using wrong configuration
On Friday, December 7, 2018 at 6:57:14 PM UTC+5:30, Nilesh Kemse wrote:
>
> I am using JOOQ with vertx with latest version i.e 4.0.0. In this I am
> using JDBCClassicGenericQueryExecutor for query execution and using
> transactionAsync() method for transaction management. Following is my code
> sample
>
> Vertx vertx = Vertx.currentContext().owner();
>
> Configuration configuration = JooqConfiguration.getConfiguration();
>
> System.out.println("created connection");
>
> JDBCClassicGenericQueryExecutor queryExecutor = new
> JDBCClassicGenericQueryExecutor(configuration,vertx);
>
>
> Future<CompletableFuture> updatedCustom =
> queryExecutor.executeAny(dslContext
> -> {
> CompletionStage<?> completionStage = dslContext.
> transactionAsync(config -> {
> DSLContext transactionContext = DSL.using(configuration);
> transactionContext
> .update(Tables.ACCOUNT_USER)
> .set(Tables.ACCOUNT_USER.USERNAME ,"abc")
> .where(Tables.ACCOUNT_USER.USER_ID.eq("111")).
> execute();
>
> // throwing RuntimeException() here to check transaction
>
> transactionContext
> .update(Tables.ACCOUNT_USER)
> .set(Tables.ACCOUNT_USER.USERNAME ,"xyz")
> .where(Tables.ACCOUNT_USER.USER_ID.eq("222")).execute();
>
>
> });
> return completionStage.toCompletableFuture();
> });
>
>
>
>
> updatedCustom.setHandler(res -> {
> if (res.succeeded()) {
> System.out.println("Rows updated");
> } else {
> System.err.println("Something failed badly");
> }
> });
>
>
>
> But it is failing to rollback updation of first query after exception. Do
> we need to do something different for transaction management. It was
> working for Dao's executeAsync() method for io.github.jklingsporn:vertx-
> jooq-classic:2.4.1.
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.