JDBC, Transactions, Spring Data JPA
July 30, 2021

M03 Q16 Where can the @Transactional annotation be used? What is a typical usage if you put it at class level?

@Transactional can be used on top of class or method, in classes or interfaces.

If used on top of class, it applies to all public methods in this class.

If used on top of method, it needs to have public access modifier, if used on top of protected / package-visible / private method, transaction management will not be applied.