#16401·jOOQ

TransactionPublisher shouldn't stream intermediary results prior to committing the transaction

Author: zeniosCreated Mar 1, 2024Updated Sep 10, 2026
LabelsT: DefectC: FunctionalityP: MediumE: All Editions

Expected behavior

TransactionPublisher behaves differently with regards to the blocking transaction handling of jooq.

In blocking handling anything that is executed inside the TransactionalCallable is commited and after that anything outside the callable can see the changed data if queried again against the database.

In transaction publisher commit happens onComplete which comes after on next which results in downstream publishers getting results before the transaction is commited

https://github.com/jOOQ/jOOQ/blob/f7fe2b866aabb972df0ba35a1031cc8655577e34/jOOQ/src/main/java/org/jooq/impl/R2DBC.java#L756

Actual behavior

Transaction is commited prior to onNext thus behaving exactly like the blocking counterpart.

Regarding this i am not sure if transactionPublisher is the optimal. Maybe it had to be a single ensuring that only one result can be returned

Steps to reproduce the problem

It is really simple to reproduce but in case its needed i can provide a reproduction. Actually what you need is a transaction that updates a record and on next fetch the record from the database. You will see that the record is still the old because the transaction has not commited yet.

jOOQ Version

JOOQ Professional Edition 3.19.0

Database product and version

Postgresql 16

Java Version

Openjdk 17

OS Version

No response

JDBC driver name and version (include name if unofficial driver)

No response