To reproduce, just create a table with 1 record. And run the following code:
Transaction method:
- Delete everything
- Select everything using SelectQuery
- We see that the quantity is not 0.
@Transactional
public Mono<Void> test(){
return entityRepository.deleteAll()
.thenMany(SelectQuery.from(Entity.class, "e").execute(lcClient))
.count()
.map(cnt -> cnt) //bug = is not empty
.then();
}
SelectExecution sources:
private Flux<T> executeWithoutPreSelect() {
SelectMapping mapping = buildSelectMapping();
// FIXME: there is no context for transactions
Flux<Map<String, Object>> fromDb = buildFinalSql(mapping, query.where, true, hasJoinMany()).execute().fetch().all();
return Flux.create((Consumer<FluxSink<T>>)sink -> {
RowHandler handler = new RowHandler(mapping, sink);
fromDb.doOnComplete(handler::handleEnd).subscribe(handler::handleRow, sink::error);
});
}