@Transactional ఒక method ను database transaction లో చుడుతుంది: method నడిచే ముందు Spring ఒకదాన్ని తెరుస్తుంది మరియు అది సాధారణంగా return అయినప్పుడు commit చేస్తుంది — లేదా అది throw చేస్తే rolls back చేస్తుంది. లోపల ఇది ఒక AOP proxy, ఇది చాలా gotchas కు మూలం.
ప్రాథమిక వినియోగం
{
{
accounts.debit(from, amount);
accounts.credit(to, amount);
}
}
