1

Suppose there are following components which are configured all together:

  • jdbc connection pool
  • DataSource
  • Dao

Suppose there is method which is marked with @org.springframework.transaction.annotation.Transactional and contains several dao methods calls. Do all these dao methods use the same connection during transaction or not?

Cherry
  • 31,309
  • 66
  • 224
  • 364

1 Answers1

0

If they all have the same Datasource, and you are only using Spring to create and manage your transactions, then yes.

Reason: because of isolation and propagation behaviour see: Spring @Transactional - isolation, propagation, there will only be one transaction which all the DAO methods use. And there is only one connection used per a transaction in JDBC.

Community
  • 1
  • 1
Derrops
  • 7,651
  • 5
  • 30
  • 60