enter image description hereWhen I using JpaSpecificationExecutor doing findAll, I found it automatically adding transaction, starting sql with
set autocommit = 0;
And I don't want it.
I test JpaRepository, doing the same select sql and it didn't go with set autocommit = 0;
but the JpaSpecificationExecutor has.
Then I break point it and find out there is a PROXY do that adding transaction thing, but I don't know how to disable it.
I do set defaultAutoCommit: true
And I also set
datasource:
tomcat:
default-auto-commit: true
dbcp2:
default-auto-commit: true
the connection pool is already defaultAutoCommit=true
it didn't help
so I blame the JpaSpecificationExecutor
@Repository
public interface GameRepository extends JpaRepository<GameEntity, Integer>, JpaSpecificationExecutor<GameEntity> {
List<GameEntity> findByName(String name);
}
public List<GameEntity> search(HttpServletRequest request) {
return mGameRepository.findAll(searchAction(request), new Sort(Sort.Direction.DESC, "id"));
}
Turns out all the CRUD methods (CrudRepository methods) are by default marked as transactional.
But how can I unmark it?