MyBatis version
3.4.6
Database vendor and version
Sql Server, jtds driver version- 1.3.1
Test case or example project
mybatis config file contains below setting-
<setting name="defaultStatementTimeout" value="1"/>
mybatis mapper contains below query-
WAITFOR DELAY '00:00:10';
Steps to reproduce
One test case which is executing the above query.
As the defaultStatementTimeout is 1 and query is executed for 10 sec, the timeout exception should be thrown. But the test case passed happily.
Expected result
Expectation is timeout
Actual result
But the test case passed
According to the official documentation- https://mybatis.org/mybatis-3/configuration.html
defaultStatementTimeout should limit the waiting time of query. Why is it not working in this case?
Comment From: harawata
Thank you for the report, @ujjaldas1997 !
I tried, but couldn't reproduce it i.e. the query timed out as you expected.
Here is the test case: https://github.com/harawata/mybatis-issues/tree/gh-1870/gh-1870
Please compare it with your code and let us know if there is any condition that is required for reproduction.
You may need to edit the data source settings in /src/test/resources/test/mybatis-config.xml
.
Comment From: ujjaldas1997
Hey @harawata , sorry for the late reply. I am describing 2 quieries here.
query-1 : waitfor delay '00:00:10'; select <columns> from <table>
The test containing the above query fails obeying defaultStatementTimeout=1
qeury-2 : select <columns> from <table>; waitfor delay '00:00:10'
The test containing the above query passes by not honoring defaultStatementTimeout=1
Note that by swapping the query statements, the test results are different.
Comment From: harawata
@ujjaldas1997 , Please provide a repro as I did. Or send a pull request that contains changes required to reproduce the problem with my project.
Comment From: harawata
No response.