26
Yes, it will. Regardless of nesting, if an atomic block is exited by an exception it will roll back:
是的,它会。不管嵌套是什么,如果一个原子块被异常退出,它将回滚:
If the block of code is successfully completed, the changes are committed to the database. If there is an exception, the changes are rolled back.
如果代码块成功完成,则将更改提交给数据库。如果有异常,则回滚更改。
Note also that an exception in an outer block will cause the inner block to roll back, and that an exception in an inner block can be caught to prevent the outer block from rolling back. The documentation addresses these issues. (Or see here for a more comprehensive follow-up question on nested transactions).
还要注意,外部块中的异常将导致内部块回滚,并且可以捕获内部块中的异常以防止外部块回滚。文档解决了这些问题。(关于嵌套事务的更全面的后续问题,请参见这里)。