I am using Spring Boot v3.0.6 / Spring v6.0.8/ oracle 19c / Java 17.0.5 , trying to set timeout for repositories findBy Field/All [findByName] , calling the methods from a Service method with @Transactional, it does not work and the query exceeds 15 seconds However it works fine for other repositories methods that have @Query annotation

@Repository
public interface Repo extends JpaRepository<EntityX, Long>, JpaSpecificationExecutor<EntityX>

    public List<EntityX> findAll()
        public List<EntityX> findByName()

I have set the following app Properties

spring:
  transaction:
    default-timeout: 15s
 jpa:
    properties:
      jakarta.persistence.query.timeout: 15000
      jakarta.persistence.lock.timeout: 15000

I also tried this following code with no results

       @Transactional(timeout = 15)
    public List<EntityX> findAll()

Comment From: wilkinsona

This looks very similar to https://github.com/spring-projects/spring-boot/issues/33866 which was a Hibernate issue that should have been fixed in Hibernate 6.1.7. You haven't said which version of Hibernate you are using, but I would recommend checking that it is at least 6.1.7. If that doesn't help, I think this is most likely to be a different but similar bug in Hibernate that should be reported to the Hibernate team along with a complete, yet minimal example. If you have evidence that the problem is caused by Spring Boot or Spring Data JPA, please provide a complete yet minimal example that demonstrates this (that is to say something that works when calling Hibernate directly but fails when using Spring Data JPA or Spring Data JPA and Spring Boot) and we can take another look.

Comment From: ahmedmaksoud

I am using Hibernate 6.1.7 and checked this issue #33866 , I can produce the issue on Oracle database but on postgres it is working as expected