Programmatic transaction management

Report a typo

Which methods of the following class will initiate a database transaction?

Java
@Transactional
public class AccountService {
    private final AccountRepo accountRepo;

    public AccountService(AccountRepo accountRepo) {
        this.accountRepo = accountRepo;
    }

    public void saveAccount(Account account) {
        accountRepo.save(account);
    }

    private Optional<Account> findAccount(Long id) {
        return accountRepo.findById(id);
    }
}
Kotlin
@Transactional
class AccountService(private val accountRepo: AccountRepo) {

    fun saveAccount(account: Account) {
        accountRepo.save(account)
    }

    private fun findAccount(id: Long): Optional<Account> {
        return accountRepo.findById(id)
    }
}
Select one option from the list
___

Create a free account to access the full topic