For example, suppose a situation like this:
Class A {
now when you want to save B, you first save A suppose that while saving A you have any utility calls to check, etc., this is the situation when saving B (some checks), so you need to roll back if B may not be verified, also you should rollback when you cannot confirm A, so you had to invest one (actually Separation of anxiety , you can mix all things and have spaghetti code without nested transactions).
source share