@Transactional wraps a method in a database transaction: Spring opens one before the method runs and commits when it returns normally — or rolls back if it throws. Under the hood it is an AOP proxy, which is the source of most gotchas.
Basic usage
{
{
accounts.debit(from, amount);
accounts.credit(to, amount);
}
}
