I am using Jooq in a Spring Application with a Hikari pool. The transaction management is Spring default. I am trying to use the .stream() functionality with .fetchSize(), however I get the warning "A fetch size of x was set on a auto-commit PostgreSQL connection, which is not recommended". Tried to disable the autocommit with:
final Connection connection = dslContext.configuration().connectionProvider().acquire();
connection.setAutoCommit(false);
DSL.using(connection)
.select(USER.fields()).
.from(USER)
.fetchSize(1000)
.stream()
But I am still getting the warning and all the results are returned. How can I set autocommit to false?
The issue was that I was executing the query in a thread, thus the Spring @Transactional was not applied.