title: Spring boot Oracle JPA set QueryTimeout
body: <p>I'm using Spring Boot with Ojdbc8 18.3.0.0.0
  With Hikari Datasource and JPA, all query work fine.
  But now I need to set Query timeout for all database query
  I was try many way:</p>
  
  <pre><code>javax.persistence.query.timeout=1000
  spring.transaction.default-timeout=1
  spring.jdbc.template.query-timeout=1
  spring.jpa.properties.hibernate.c3p0.timeout=1
  spring.jpa.properties.javax.persistence.query.timeout=1
  </code></pre>
  
  <p>Config Class:</p>
  
  <pre><code>@Configuration
  public class JPAQueryTimeout {
  
      @Value("${spring.jpa.properties.javax.persistence.query.timeout}")
      private int queryTimeout;   
  
      @Bean
      public PlatformTransactionManager transactionManager() throws Exception {
          JpaTransactionManager txManager = new JpaTransactionManager();
          txManager.setDefaultTimeout(queryTimeout); //Put 1 seconds timeout
          return txManager;
      }
  }
  </code></pre>
  
  <p>Query:</p>
  
  <pre><code>List&lt;Integer&gt; llll = manager.createNativeQuery("select test_sleep(5) from dual")
              .setHint("javax.persistence.query.timeout", 1).getResultList();
  </code></pre>
  
  <p>The database task take 5 second before return value, but in all of case, no error occor.</p>
  
  <p>Could anyone tell me how to set query timeout?</p>