How to enable transactional in jooq with r2dbc
- User
How to enable transactional in jooq with r2dbc
- Assistant
In order to enable transactional support in jOOQ with R2DBC, you need to do the following:
-
Create a jOOQ Configuration object as usual.
-
Set the execution listener on the configuration object to use a TransactionListener that can handle R2DBC transactions. For example:
Configuration configuration = DSL.using(dataSource); configuration.set(new DefaultTransactionProvider("r2dbc:postgress://localhost/mydb"), new R2dbcTransactionListener());In this example, we assume that you're using PostgreSQL as your database and that the database is running locally on port 5432. Change these details as necessary for your own use-case.
- Now you can start using transactions in your application code as usual, using the jOOQ
Transactionobject. For example:
-