在 Spring 数据中删除交易?
Making Transactional deletes in Spring Data?
我有一个正在使用“Spring 数据”的应用程序。
我想确保执行 both 删除(下面的代码),或者 rollback 发生。
如何确保下面显示的 .delete()
方法是 transactional
?
@Service
public class databaseService{
//some code
public void deleteRows(){
carRepository.delete(car);
personRepository.delete(person);
}
}
看看@Transactional 注释。
我有一个正在使用“Spring 数据”的应用程序。
我想确保执行 both 删除(下面的代码),或者 rollback 发生。
如何确保下面显示的 .delete()
方法是 transactional
?
@Service
public class databaseService{
//some code
public void deleteRows(){
carRepository.delete(car);
personRepository.delete(person);
}
}
看看@Transactional 注释。