Hi guys, I would like to check on timeout with jdbcTemplate. Please advise if I am wrong.
I am trying to have a timeout for a very heavy query (select * from ....) But when I set the jdbcTemplate.setQueryTimeout, it does not have any effect.
I also tried using the transaction annotation on the method itself, but it seems that there is no effect either.
Code:11:14:52,676 [TEST] DEBUG [saction.support.AbstractPlatformTransactionManager:371] - Creating new transaction with name [testPackage.getInfo]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,timeout_1 11:14:53,348 [TEST] DEBUG [ework.jdbc.datasource.DataSourceTransactionManager:202] - Acquired Connection [jdbc:oracle:thin:@localhost:1521:xe, UserName=userTest, Oracle JDBC driver] for JDBC transaction 11:14:53,348 [TEST] DEBUG [ework.jdbc.datasource.DataSourceTransactionManager:219] - Switching JDBC Connection [jdbc:oracle:thin:@localhost:1521:xe, UserName=userTest, Oracle JDBC driver] to manual commit 11:14:53,348 [TEST] DEBUG [org.springframework.jdbc.core.JdbcTemplate:436] - Executing SQL query [select * .....]I am expecting a timeout of 1 second to happen like the following (BUT IT DOES NOT, ONLY ON EXCEPTION)Code:@Transactional(timeout = 1) public void getInfo() { ..... }
So basically I do not see a timeout and the method seems to run forever. Anyone can please advise?Code:DEBUG [ework.jdbc.datasource.DataSourceTransactionManager:273] - Rolling back JDBC transaction on Connection [jdbc:oracle:thin:@localhost:1521:xe, UserName=, Oracle JDBC driver] DEBUG [ework.jdbc.datasource.DataSourceTransactionManager:314] - Releasing JDBC Connection [jdbc:oracle:thin:@localhost:1521:xe, UserName=, Oracle JDBC driver] after transaction DEBUG [rg.springframework.jdbc.datasource.DataSourceUtils:312] - Returning JDBC Connection to DataSource


Reply With Quote
