Rollback on every checked exception, whenever I say @Transactional

前端 未结 4 596
有刺的猬
有刺的猬 2020-12-02 17:04

Since the programmer is forced to catch all checked exception, I to throw checked exception in case of any problem. I would like to rollback on any of those expections. Writ

4条回答
  •  温柔的废话
    2020-12-02 17:35

    Looks like you can configure a transactional advice based on method name like this: (from the Spring 2.0 docs)

    Exactly which Exception types mark a transaction for rollback can be configured. Find below a snippet of XML configuration that demonstrates how one would configure rollback for a checked, application-specific Exception type.

    
        
          
          
        
    
    

提交回复
热议问题