@Transactional method ને database transaction માં લપેટે છે: Spring method ચાલે તે પહેલાં એક ખોલે છે અને તે સામાન્ય રીતે return થાય ત્યારે commit કરે છે — અથવા throw થાય તો rollback કરે છે. અંદરથી તે એક AOP proxy છે, જે મોટા ભાગની gotchas નું મૂળ છે.
મૂળભૂત ઉપયોગ
{
{
accounts.debit(from, amount);
accounts.credit(to, amount);
}
}
