【发布时间】:2014-08-10 21:44:01
【问题描述】:
如问题所述,实际事务在春季声明性事务管理中提交的位置。例如,假设我有以下代码
@Service
@Transactional
class CustomerAService{
public void processCustomer(Customer customer){
//call dao and insert customer
furtherProcessCustomer(Customer customer);
//last line (a)
}
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void furtherProcessCustomer(Customer customer){
//call another dao do some db work
//last line (b)
}
}
假设如果我停止执行@ line //last line (a),那么 processCustomer() 方法的事务将被提交。我试图在网上搜索,但没有得到太多信息
【问题讨论】:
-
@WornOutSoles 虽然我的问题与 Propagation.REQUIRES_NEW 无关,但在阅读 beerbajay 的回答后,我对 Propagation.REQUIRES_NEW 的使用有点困惑。对于那个病在网上找到一些信息,否则问问题。
标签: java spring spring-mvc jdbc transactions