0

I am using AtomikosDataSource and setting the datasource in Ibatis SqlSessionFactoryBean (db2 database). When my select query is running it is taking 15 seconds and returning the values, but i already have set below properties in my property files.

com.atomikos.icatch.default_jta_timeout = 3000
com.atomikos.icatch.max_timeout = 3000

Hence, i expect this transaction should reply me back as timeout error, but instead it keep running even after 3 seconds. But the same code works fine (that is throws timeout error for CREATE/UPDATE services of course these create/update services marked with annotation @Transactional. For select query service am not using @Transactional since it is just a fetch operation)

Note: I am using Spring & Atomikos 4.0.4.

u-ways
  • 6,136
  • 5
  • 31
  • 47
user2000189
  • 479
  • 4
  • 6
  • 22
  • If you don't have a tx, then there is also no timeout. Also you should really use a tx also for reading (in fact there is always a tx on the DB side in this case an implicit one!). – M. Deinum Dec 05 '19 at 08:48
  • @M.Deinum do you mean that, i need to use "@Transactional" for select query service also? in order to get timeout? – user2000189 Dec 05 '19 at 09:30
  • That is exactly what I'm saying. – M. Deinum Dec 05 '19 at 11:18

1 Answers1

0

For select query service am not using @Transactional

That's causing your issue, you need to mark your block as @Transactional.

since it is just a fetch operation

Actually, setting @Transactional(readOnly = true) can trigger some optimisations in your transaction infrastructure.

See: What are advantages of using @Transactional(readOnly = true)?

u-ways
  • 6,136
  • 5
  • 31
  • 47