I want to throw timeout exception , If my query takes more than 10 secs to execute .
I am using Hikari datasource properties and spring jdbc template. I executed the same update statement without commit, in oracle client to bring the deadlock scenario . My code keeps waiting to execute not throwing timeout exception.
@Bean
public JdbcTemplate jdbcTemplate(HikariDataSource ds) {
JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);
jdbcTemplate.setQueryTimeout(10);
return jdbcTemplate;
}
public class DaoImpl {
@Autowired
JdbcTemplate jdbcTemplate;
methodToUpdateQuery() {
jdbcTemplate.update(sqlQuery);
}
}