I know that this is probably a duplicate, and ironically, before I started reading about it here and there, I thought, I knew what it was for ( needless to say , but I will still say it, please correct me where I'm wrong):
This eliminates the need for the programmer to use transaction.begin() and commit() .
If you have a method that calls two DAO methods, each of which usually has transaction.begin and transaction.commit , covering real operations, and calls them, this will lead to two transactions (and there may be problems with rollback if the previous method was supposed DAO). roll back too).
But if you use @transactional in your method, then all these DAO calls will be enclosed in one begin() loop - commit() . Of course, if you use @Transactional , the DAO should not use the begin() and commit() methods, as it seems to me.
source share