在使用@Transactional注解前需于下配置,两种方式都可以。
@Transactional使用实例
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
public void updateFoo(Foo foo) {
}
 @Transactional 可配置属性
    
    
        
            | Property | Type | Description | 
    
    
        
            | value | String | Optional qualifier specifying the transaction manager to be used. | 
        
            | propagation | enum: Propagation | Optional propagation setting. | 
        
            | isolation | enum: Isolation | Optional isolation level. | 
        
            | readOnly | boolean | Read/write vs. read-only transaction | 
        
            | timeout | int (in seconds granularity) | Transaction timeout. | 
        
            | rollbackFor | Array of Classobjects, which must be derived fromThrowable. | Optional array of exception classes that must cause rollback. | 
        
            | rollbackForClassname | Array of class names. Classes must be derived from Throwable. | Optional array of names of exception classes that must cause rollback. | 
        
            | noRollbackFor | Array of Classobjects, which must be derived fromThrowable. | Optional array of exception classes that must not cause rollback. | 
        
            | noRollbackForClassname | Array of Stringclass names, which must be derived fromThrowable. | Optional array of names of exception classes that must notcause rollback. 
 
 | 
    
 
 
	posted on 2010-10-06 20:03 
岁月神偷 阅读(4121) 
评论(0)  编辑  收藏  所属分类: 
Spring