[英]@Transactional propagation on private methods
I have the following code: 我有以下代码:
@Service
public class MyService implements IMyService {
@Inject
IAnotherService anotherService;
// injects go here
// some code
@Transactional(isolation=Isolation.SERIALIZABLE)
public Result myMethod() {
// stuff done here
return this.myPrivateMethod()
}
private Result myPrivateMethod() {
// stuff done here
// multiple DAO SAVE of anObject
anotherService.processSomething(anObject);
return result;
}
}
@Service
public class AnotherService implements IAnotherService {
// injections here
// other stuff
@Transactional(isolation=SERIALIZABLE)
public Result processSomething(Object anObject) {
// some code here
// multiple dao save
// manipulation of anObject
dao.save(anObject);
}
}
@Transactional
behavior propagate to myPrivateMethod even if it's private?. @Transactional
行为是否传播到myPrivateMethod,即使它是私有的? Runtime Exception
occurs on processSomething()
, and processSomething
is called from myPrivateMethod
, will myPrivateMethod
and myMethod
do rollback?. processSomething()
上发生Runtime Exception
,并且从myPrivateMethod
调用processSomething
, myPrivateMethod
和myMethod
会回滚吗? @Service
?. @Service
情况下实现这一目标? How can I do extract method and invoke multiple private methods inside a public service method within a @Transactional
context?. @Transactional
上下文中的公共服务方法中提取方法并调用多个私有方法? isolation=Isolation.SERIALIZABLE
option a good alternative to synchronized
methods?. isolation=Isolation.SERIALIZABLE
选项是synchronized
方法的一个很好的替代方案吗? I know this has been answered already but I'm still having doubts. 我知道这已经回答了,但我仍然有疑虑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.