I am trying to use spring @Transactional
annotation and timeout
parameter. I basically test the code with put some Thread.sleep()
codes. Then i get timeout exception as i expected. Also i want to get timeout exception when database operations take longer than my timeout period. I lock a record in a table in my database with for update select statement. I try to update that record. But program wait and do nothing. Here my sample code.
@Transactional(rollbackFor = Exception.class, timeout=5)
public void executeService(List<sendData> list) throws Exception{
List<sendData> newList = gDAO.updateSentList(list);
}
In this case the program should throw timeout exception. How can i fix it?
I solved my problem using oracle.jdbc.ReadTimeout=60000
on application context. @Transactional
annotation do not work on jdbc read timeout exception.