Hi Is their a way to set autocommit to false in spring jdbctemplate.
The thing is instead of transaction (where their is rollback option), I want to have query committed at end of transaction.
So instead of
insert --> commit --> rollback.
I want insert --> fail --> (no commit).
I did not understand your whole question, but I can answer the first part: Is there a way to set autocommit to false in spring jdbctemplate?
The autocommit configuration is normally set on the connection itself. The
Connectionis created by theDatasource. As theJdbcTemplatedoes not have an option to manually disable auto commit in the connections it requests to the Datasource, the way to achieve this is using aDatasourcethat creates connections withautocommitset tofalseby default.This example configuration using apache commons
BasicDataSourceachieves that: