这里没有记录https://www.jooq.org/doc/latest/manual/sql-execution/transaction-management/
它仅向您显示未捕获的异常将导致回滚。
问题是RollbackToSavepointStep
不是Publisher
。
是否可以通过编程方式回滚?
如果我尝试的dsl().rollback().executeAsync().await()
话我会得到:
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.org/doc/latest/manual/sql-execution/fetching/reactive-fetching/
您可以使用该
ROLLBACK
语句并被动执行。但不能使用executeAsync()
,因为异常表明它目前没有任何 R2DBC 支持的实现。从 jOOQ 3.19 开始,有一个针对此功能的功能请求:相反,你应该可以这样写:
请注意,由于 jOOQ 3.19.18 及更早版本中存在此错误,此功能目前不起作用:
该
Rollback
类型仅扩展了Query
,而不是RowCountQuery
,即Publisher<Integer>
。鉴于这只是错误的 API 规范的问题,请改为执行以下操作作为解决方法: