Skip to content

SelectExecution#executeWithoutPreSelect does not pass the reactive context to the fromDb variable, which is why transactions do not work. #28

@ost-av

Description

@ost-av

To reproduce, just create a table with 1 record. And run the following code:
Transaction method:

  1. Delete everything
  2. Select everything using SelectQuery
  3. 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);
		});
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions