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