Transactions, Spring.
private RepositoryUser repository; @Transactional public void invoice() { repository.save(something); invoiceService.createPdf(); // send invoice as email, etc. }} @Service public class InvoiceService { @Transactional public void createPdf() { // … } } UserService has a transactional invoice()