Transactions, Spring.
as transactional @Transactional public class UserService { public User getUser(String id) { // DB call } public User saveUser(User user) { // DB call } Using Transactional annotation on a method also marks that class as transactional public class UserService { @Transactional public User