4.1.0
- The main addition in this release is transaction support for reactive modules.
Transaction are now added onto the reactive variants of theQueryExecutor
. There are two ways to work with transactions:- The manual mode involves starting and manually committing or rolling back the transaction.
Future<Void> transactionWork = dao.queryExecutor() .beginTransaction() .compose( transactionQE -> { //only work on the "transactional" QueryExecutor returned by the beginTransaction() method Future<Integer> insert1 = transactionQE.execute(dslContext -> dslContext.insertInto() ....; Future<Integer> insert2 = transactionQE.execute(dslContext -> dslContext.insertInto() ....; return CompositeFuture .all(insert1,insert2) .compose(v->transactionQE.commit() /*or .rollback()*/); //don't forget to commit your transaction });
- The "convenient mode"" is the best choice for most situations. It allows you to work in a transactional context that
automatically commits your work when you are done. You can also return a value from your transactional work.Future<Void> transactionWork = dao.queryExecutor() .transaction( transactionQE -> { //only work on the "transactional" QueryExecutor returned by the transaction() method Future<Integer> insert1 = transactionQE.execute(dslContext -> dslContext.insertInto() ....; Future<Integer> insert2 = transactionQE.execute(dslContext -> dslContext.insertInto() ....; return CompositeFuture.all(insert1,insert2); //or return some result });
- The manual mode involves starting and manually committing or rolling back the transaction.
- Another important change was the switch to a maintained fork of the async driver
which was introduced in vertx 3.6.3 and will be the default implementation in the next releases.
The API stays the same but the driver is written in Kotlin instead of Scala. Checkout the migration guide
for more details. - Click here for a complete list of all features and bugfixes.