admin管理员组文章数量:1290935
It's not documented here /
It only shows you that an uncaught exception will cause a rollback.
The problem is that RollbackToSavepointStep
is not a Publisher
.
Is it possible to programmatically rollback at all?
If I try dsl().rollback().executeAsync().await()
then I get:
DetachedException: Attempt to execute a blocking method (e.g. Query.execute() or ResultQuery.fetch()) when only an R2BDC ConnectionFactory was configured. jOOQ's RowCountQuery and ResultQuery extend Publisher, which allows for reactive streams implementations to subscribe to the results of a jOOQ query. Simply embed your query in the stream, e.g. using Flux.from(query). See also: /
It's not documented here https://www.jooq./doc/latest/manual/sql-execution/transaction-management/
It only shows you that an uncaught exception will cause a rollback.
The problem is that RollbackToSavepointStep
is not a Publisher
.
Is it possible to programmatically rollback at all?
If I try dsl().rollback().executeAsync().await()
then I get:
DetachedException: Attempt to execute a blocking method (e.g. Query.execute() or ResultQuery.fetch()) when only an R2BDC ConnectionFactory was configured. jOOQ's RowCountQuery and ResultQuery extend Publisher, which allows for reactive streams implementations to subscribe to the results of a jOOQ query. Simply embed your query in the stream, e.g. using Flux.from(query). See also: https://www.jooq./doc/latest/manual/sql-execution/fetching/reactive-fetching/
Share
Improve this question
asked Feb 13 at 15:35
Jakub BochenskiJakub Bochenski
3,2774 gold badges38 silver badges67 bronze badges
1 Answer
Reset to default 1You can use the ROLLBACK
statement and execute that reactively. Just not with executeAsync()
, which currently doesn't have any R2DBC backed implementation as the exception states. There's a feature request for this as of jOOQ 3.19:
- https://github/jOOQ/jOOQ/issues/15907
Instead, you should be able to just write:
dsl().rollback().awaitSingle()
Note, this currently doesn't work because of this bug in jOOQ 3.19.18 and earlier:
- https://github/jOOQ/jOOQ/issues/18014
The Rollback
type extends only Query
, not RowCountQuery
, which is a Publisher<Integer>
. Given that this is just a matter of wrong API specification, do this, instead, as a workaround:
(dsl().rollback() as RowCountQuery).awaitSingle()
版权声明:本文标题:kotlin coroutines - How to programmatically rollback transaction using Jooq Non blocking API? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741520462a2383150.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论