0

Do I need to annotate my Service methods as @Transactional to make sure that the connections opened by the Repository layer is closed? What if I don't annotate as @Transactional? Will this lead to open connections\inactive sessions?

Neil Stockton
  • 11,383
  • 3
  • 34
  • 29
Chillax
  • 4,418
  • 21
  • 56
  • 91
  • Possible duplicate of [Spring - @Transactional - What happens in background?](http://stackoverflow.com/questions/1099025/spring-transactional-what-happens-in-background) – diziaq Dec 21 '15 at 06:17
  • 4
    No. You need to annotate them as Transactional to make sure that everything done inside the method happens in a single, atomic, consistent, isolated, durable, transaction. – JB Nizet Dec 21 '15 at 07:04
  • 1
    Connection handling is done within the connection pool, not in the transaction. – Uwe Allner Dec 21 '15 at 10:20

0 Answers0