@Transactional किसी method को एक database transaction में लपेटता है: Spring method चलने से पहले एक transaction खोलता है और सामान्य रूप से return होने पर commit करता है — या यदि यह throw करता है तो roll back करता है। पर्दे के पीछे यह एक AOP proxy है, जो अधिकांश gotchas का स्रोत है।
बुनियादी उपयोग
{
{
accounts.debit(from, amount);
accounts.credit(to, amount);
}
}
