IOException is usually try catch, DBException in this layer and often throws to the outer layer. Why?

usually look at the code and find that
IOException is usually try catch, DBException and TransactionAbortedExcetion in this layer and often throws to the outer layer. Why?

Mar.21,2022

@ Slim of Hula Forest, your understanding is insufficient. In essence, you still do not realize that Spring there is an exception in this layer of transaction processing logic. It is a question whether you need to let the upper layer's application get universal processing. The second is the problem of transaction rollback. If you eat the exception, you know the exception, but the transaction managed by Spring does not know the exception. Then Spring also needs the exception of this transaction to roll back your code. If you try {} catch {} , then the annotation is invalid. This is what gets the exception and needs to be thrown again.


this is to look at the specific business. You can handle it if you can handle it at this level. If you don't know how to handle it or the upper layer is more appropriate, you can only ask the code writer


.

Menu